Skip to content

Commit

Permalink
fix: propagate bin name at lift and list subcommand and task
Browse files Browse the repository at this point in the history
  • Loading branch information
rafamel committed Apr 1, 2021
1 parent 9be1ae5 commit ad142f6
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/bin/kpo.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env node
import { bin } from './index';

bin({ bin: 'kpo' });
bin();
3 changes: 2 additions & 1 deletion src/bin/lift.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ export default async function bin(
print(),
lift(params.record, {
purge: cmd['--purge'],
mode: cmd['--mode'] as any
mode: cmd['--mode'] as any,
bin: opts.bin
})
);
}
4 changes: 2 additions & 2 deletions src/bin/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default async function main(
const pkg = await loadPackage(__dirname, { title: true });

const help = indent`
${pkg.description ? chalk.bold(pkg.description) : ''}
${pkg.description ? chalk.bold(pkg.description) : ''}
Usage:
$ ${opts.bin} [options] [command]
Expand Down Expand Up @@ -161,7 +161,7 @@ export default async function main(
log('debug', 'Working directory:', process.cwd()),
log('info', chalk.bold(opts.bin), chalk.bold.blue(':list')),
print(),
list(record)
list(record, { bin: opts.bin })
),
withContext
);
Expand Down
4 changes: 2 additions & 2 deletions src/tasks/reflection/lift.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ export function lift(tasks: Task.Record, options?: LiftOptions): Task.Async {
}
const content = await fs.readFile(pkgPath);
const pkg = JSON.parse(content.toString());

const pkgScripts: Members<string> = pkg.scripts || {};

const taskScripts = into(
tasks,
parseToRecord.bind(null, { include: null, exclude: null }),
Expand All @@ -59,7 +59,7 @@ export function lift(tasks: Task.Record, options?: LiftOptions): Task.Async {
return keys.reduce(
(acc: Members<string>, name) => ({
...acc,
[name]: opts.bin ? `${opts.bin} ${name} --` : `${name} --`
[name]: `${opts.bin} ${name} --`
}),
{}
);
Expand Down
4 changes: 1 addition & 3 deletions src/tasks/reflection/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ export function list(
? items.map((item) => map(item.name, item.route))
: items.map((item) => {
return [
(opts.bin ? `${opts.bin} ` : '') +
chalk.bold(item.name) +
' '.repeat(4),
opts.bin + ' ' + chalk.bold(item.name) + ' '.repeat(4),
...Array(item.route.length).fill(''),
item.route[item.route.length - 1],
...Array(maxRouteLength - item.route.length).fill('')
Expand Down

0 comments on commit ad142f6

Please sign in to comment.