Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: silent flag parameter #415

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ We encourage the developer community to contribute to this repository. This guid

- [Node](https://nodejs.org/) >= 14
- [yarn](https://yarnpkg.com/) >= 1.22.5
- [Code Climate](https://github.com/codeclimate/codeclimate) (If you are on MacOS, you will need Xcode Command Line Tools)
gavignon marked this conversation as resolved.
Show resolved Hide resolved

## Installation

Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,16 @@ If you run your CI/CD jobs inside a Docker image, you can add the plugin to your
## How to use it?

<!-- commands -->
* [`sfdx sgd:source:delta -f <string> [-t <string>] [-r <filepath>] [-i <filepath>] [-D <filepath>] [-s <filepath>] [-W] [-o <filepath>] [-a <number>] [-d] [-n <filepath>] [-N <filepath>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-sgdsourcedelta--f-string--t-string--r-filepath--i-filepath--d-filepath--s-filepath--w--o-filepath--a-number--d--n-filepath--n-filepath---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
* [`sfdx sgd:source:delta -f <string> [-t <string>] [-r <filepath>] [-i <filepath>] [-D <filepath>] [-s <filepath>] [-W] [-o <filepath>] [-a <number>] [-d] [-n <filepath>] [-N <filepath>] [-S] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-sgdsourcedelta--f-string--t-string--r-filepath--i-filepath--d-filepath--s-filepath--w--o-filepath--a-number--d--n-filepath--n-filepath--s---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)

## `sfdx sgd:source:delta -f <string> [-t <string>] [-r <filepath>] [-i <filepath>] [-D <filepath>] [-s <filepath>] [-W] [-o <filepath>] [-a <number>] [-d] [-n <filepath>] [-N <filepath>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
## `sfdx sgd:source:delta -f <string> [-t <string>] [-r <filepath>] [-i <filepath>] [-D <filepath>] [-s <filepath>] [-W] [-o <filepath>] [-a <number>] [-d] [-n <filepath>] [-N <filepath>] [-S] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`

Generate the sfdx content in source format and destructive change from two git commits

```
USAGE
$ sfdx sgd:source:delta -f <string> [-t <string>] [-r <filepath>] [-i <filepath>] [-D <filepath>] [-s <filepath>] [-W]
[-o <filepath>] [-a <number>] [-d] [-n <filepath>] [-N <filepath>] [--json] [--loglevel
[-o <filepath>] [-a <number>] [-d] [-n <filepath>] [-N <filepath>] [-S] [--json] [--loglevel
trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

OPTIONS
Expand All @@ -148,6 +148,9 @@ OPTIONS
-N, --include-destructive=include-destructive file listing paths to explicitly
include for any destructive actions

-S, --silent no output if the command executed
successfully, default to false.

-W, --ignore-whitespace ignore git diff whitespace (space,
tab, eol) changes

Expand Down
1 change: 1 addition & 0 deletions messages/delta.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ module.exports = {
includeFlag: 'file listing paths to explicitly include for any diff actions',
includeDestructiveFlag:
'file listing paths to explicitly include for any destructive actions',
silentFlag: 'no output if the command executed successfully, default to false.'
gavignon marked this conversation as resolved.
Show resolved Hide resolved
}
8 changes: 7 additions & 1 deletion src/commands/sgd/source/delta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ export default class SourceDeltaGenerate extends SfdxCommand {
char: 'N',
description: messages.getMessage('includeDestructiveFlag'),
}),
'silent': flags.boolean({
char: 'S',
scolladon marked this conversation as resolved.
Show resolved Hide resolved
description: messages.getMessage('silentFlag'),
}),
}

public async run(): Promise<AnyJson> {
Expand Down Expand Up @@ -104,7 +108,9 @@ export default class SourceDeltaGenerate extends SfdxCommand {
output.error = err.message
process.exitCode = 1
}
this.ux.log(JSON.stringify(output, null, 2))
if(output.success && !this.flags.silent){
this.ux.log(JSON.stringify(output, null, 2))
}
gavignon marked this conversation as resolved.
Show resolved Hide resolved
return null
}
}