Skip to content

Commit

Permalink
fix: add styled header function to sf command
Browse files Browse the repository at this point in the history
Port of sandbox create references sytledHeader. Exposed styledHeader in SfCommand
@W-10657688@
  • Loading branch information
peternhale committed Mar 4, 2022
1 parent 6cc7538 commit 5cc0e8b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"/messages"
],
"dependencies": {
"@oclif/core": "^1.5.1",
"@oclif/core": "^1.5.2",
"@salesforce/core": "^3.7.7",
"@salesforce/kit": "^1.5.17",
"@salesforce/ts-types": "^1.5.20",
Expand Down
4 changes: 4 additions & 0 deletions src/ux/ux.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ export class Ux extends UxBase {
public styledObject(obj: AnyJson): void {
this.maybeNoop(() => CliUx.ux.styledObject(obj));
}

public styledHeader(text: string): void {
this.maybeNoop(() => CliUx.ux.styledHeader(text));
}
}

export namespace Ux {
Expand Down
14 changes: 14 additions & 0 deletions test/unit/ux/ux.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,18 @@ describe('Ux', () => {
expect(infoStub.callCount).to.equal(0);
});
});

describe('styledHeader', () => {
it('should log stylized header', () => {
const ux = new Ux(true);
ux.styledHeader('A Stylized Header');
expect(infoStub.firstCall.args).to.deep.equal(['\u001b[2m=== \u001b[22m\u001b[1mA Stylized Header\u001b[22m\n']);
});

it('should not log anything if output is not enabled', () => {
const ux = new Ux(false);
ux.styledHeader('A Stylized Header');
expect(infoStub.callCount).to.equal(0);
});
});
});
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -492,10 +492,10 @@
widest-line "^3.1.0"
wrap-ansi "^7.0.0"

"@oclif/core@^1.5.1":
version "1.5.1"
resolved "https://registry.yarnpkg.com/@oclif/core/-/core-1.5.1.tgz#29969ebd244d1bbf0d98418a3c3620909afa4367"
integrity sha512-dlJpww5UAHv46Z7p37ytQIKDkwOmA3uQY6ChPRY6Q9/YfDD4H0z3JfA+lfVfwHkZcIpiq9XsCkhCmBw7Uoh6Iw==
"@oclif/core@^1.5.2":
version "1.5.2"
resolved "https://registry.yarnpkg.com/@oclif/core/-/core-1.5.2.tgz#23800fe249283815fdd6f441d75cf862683ab58e"
integrity sha512-K2PtU9KyZuBhmpNxFN7vG2AbQtc4ndxDTuu+pa4iK3NtTUPiXReItVj9PKqKIOGMTN+KqiEMknSl1JGa1Fab2g==
dependencies:
"@oclif/linewrap" "^1.0.0"
"@oclif/screen" "^3.0.2"
Expand Down

0 comments on commit 5cc0e8b

Please sign in to comment.