Skip to content

Commit

Permalink
feat(tasks): adds list command
Browse files Browse the repository at this point in the history
  • Loading branch information
rafamel committed Feb 18, 2021
1 parent a104a06 commit 7b4d29d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/tasks/commands/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './list';
18 changes: 18 additions & 0 deletions src/tasks/commands/list.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Task, Context } from '../../definitions';
import { parseRecord } from '../../helpers/parse-record';
import { print } from '../create/print';
import { into } from 'pipettes';
import chalk from 'chalk';

export function list(tasks: Task.Record): Task.Sync {
return (ctx: Context): void => {
const str = parseRecord(tasks)
.map((item) => {
return ' '.repeat((item.route.length - 1) * 2) + item.name;
})
.map((str) => chalk.bold(str))
.join('\n');

into(ctx, print(str));
};
}
1 change: 1 addition & 0 deletions src/tasks/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './commands';
export * from './consume';
export * from './create';
export * from './transform';

0 comments on commit 7b4d29d

Please sign in to comment.