command-workflow
Configurable command workflow that executes specific tasks based on commands. Simple, flexible, and easily expandable.
English|中文文档
Installation
npm install command-workflow -D
Usage
Basic Usage
```bash
touch cwf.config.js
import { defineConfig } from 'command-workflow'
const filename = new Date().getTime()
export default defineConfig({
steps: [{
command: 'ls',
}, {
command: 'touch #{filename}',
tags: {
filename: () => {
console.log('filename:', filename)
return filename
}
}
}, {
command: 'vim #{filename}',
tags: {
filename: () => {
return filename
}
}
}],
})
npx cwf
$ cwf
11:03:10 AM [CWF] Run command: ls
cwf.config.js node_modules package-lock.json package.json
filename: 1690340590431
11:03:10 AM [CWF] Run command: touch 1690340590431
11:03:10 AM [CWF] Run command: vim 1690340590431
✨ Done in 1.99s.
Advanced Usage
touch cwf.config.js
import { defineConfig } from 'command-workflow'
const filename = new Date().getTime()
export default defineConfig({
firstCommand: {
steps: [{
command: 'ls',
}, {
command: 'touch #{filename}',
tags: {
filename: () => {
console.log('filename:', filename)
return filename
}
}
}, {
command: 'vim #{filename}',
tags: {
filename: () => {
return filename
}
}
}],
}
})
npx cwf firstCommand
$ cwf
11:03:10 AM [CWF] Run command: ls
cwf.config.js node_modules package-lock.json package.json
filename: 1690340590431
11:03:10 AM [CWF] Run command: touch 1690340590431
11:03:10 AM [CWF] Run command: vim 1690340590431
✨ Done in 1.99s.