Skip to content

Commit

Permalink
feat: smarter progress defaults, including noTTY
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Jun 12, 2023
1 parent e0c0230 commit 2ce7882
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/ux/progress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,10 @@ export class Progress extends UxBase {
this.started = true;

this.maybeNoop(() => {
const opts = Object.assign(Progress.DEFAULT_OPTIONS, options);
opts.format = util.format(opts.format, opts.title);
const { title, ...rest } = { ...Progress.DEFAULT_OPTIONS, ...options };
this.bar = ux.progress({
format: opts.format,
barCompleteChar: opts.barCompleteChar,
barIncompleteChar: opts.barIncompleteChar,
linewrap: opts.linewrap,
...rest,
format: util.format(rest.format, title),
}) as Progress.Bar;

this.bar.setTotal(total);
Expand Down Expand Up @@ -105,6 +102,7 @@ export namespace Progress {
barCompleteChar: string;
barIncompleteChar: string;
linewrap: boolean;
noTTYOutput: boolean;
};

export type Payload = Record<string, unknown>;
Expand Down

0 comments on commit 2ce7882

Please sign in to comment.