Skip to content

Commit

Permalink
CLI: Hide key in verbose mode when same as source
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikos Vasileiou committed Dec 1, 2021
1 parent a9e68ce commit 68c3a6f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
6 changes: 5 additions & 1 deletion packages/cli/src/commands/push.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ class PushCommand extends Command {
if (_.isEmpty(data)) return;
this.log(file.green);
_.each(data, (value, key) => {
this.log(` └─ ${key}: ${value.string.underline}`);
if (key !== value.string) {
this.log(` └─ ${key}: ${value.string.underline}`);
} else {
this.log(` └─ ${value.string.underline}`);
}
_.each(value.meta, (meta, metaKey) => {
if ((_.isObject(meta) || _.isArray(meta)) && _.isEmpty(meta)) {
return;
Expand Down
14 changes: 7 additions & 7 deletions packages/cli/test/commands/push.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ describe('push command', () => {
.stdout()
.command(['push', 'test/fixtures/simple.js', '--dry-run', '-v'])
.it('outputs strings on verbose mode', (ctx) => {
expect(ctx.stdout).to.contain('Text 1: Text 1');
expect(ctx.stdout).to.contain('Text 2: Text 2');
expect(ctx.stdout).to.contain('Text 3: Text 3');
expect(ctx.stdout).to.contain('Text 4: Text 4');
expect(ctx.stdout).to.contain('Text 1');
expect(ctx.stdout).to.contain('Text 2');
expect(ctx.stdout).to.contain('Text 3');
expect(ctx.stdout).to.contain('Text 4');
expect(ctx.stdout).to.contain('occurrences: ["/test/fixtures/simple.js"]');
});

Expand All @@ -43,7 +43,7 @@ describe('push command', () => {
.stdout()
.command(['push', 'test/fixtures/', '--dry-run', '-v'])
.it('outputs strings on verbose mode', (ctx) => {
expect(ctx.stdout).to.contain('Text 1: Text 1');
expect(ctx.stdout).to.contain('Text 1');
});

test
Expand All @@ -57,7 +57,7 @@ describe('push command', () => {
.stdout()
.command(['push', 'test/fixtures/*.js', '--dry-run', '-v'])
.it('outputs strings on verbose mode', (ctx) => {
expect(ctx.stdout).to.contain('Text 1: Text 1');
expect(ctx.stdout).to.contain('Text 1');
});

test
Expand All @@ -71,7 +71,7 @@ describe('push command', () => {
.stdout()
.command(['push', 'test/fixtures/*.foo', '--dry-run', '-v'])
.it('outputs strings on verbose mode', (ctx) => {
expect(ctx.stdout).to.not.contain('Text 1: Text 1');
expect(ctx.stdout).to.not.contain('Text 1');
});

test
Expand Down

0 comments on commit 68c3a6f

Please sign in to comment.