-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(deploy): add same-commit-policy option
- Loading branch information
1 parent
1e8e23c
commit 76ff6a2
Showing
4 changed files
with
68 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
const cliparse = require('cliparse'); | ||
|
||
function getOutputFormatOption (formats = []) { | ||
const availableFormats = ['human', 'json', ...formats]; | ||
return cliparse.option('format', { | ||
aliases: ['F'], | ||
metavar: 'format', | ||
parser: (format) => { | ||
return availableFormats.includes(format) | ||
? cliparse.parsers.success(format) | ||
: cliparse.parsers.error('The output format must be one of ' + availableFormats.join(', ')); | ||
}, | ||
default: 'human', | ||
description: `Output format (${availableFormats.join(', ')})`, | ||
complete () { | ||
return cliparse.autocomplete.words(availableFormats); | ||
}, | ||
}); | ||
} | ||
|
||
function getSameCommitPolicyOption () { | ||
const availablePolicies = ['error', 'ignore', 'restart', 'rebuild']; | ||
return cliparse.option('same-commit-policy', { | ||
aliases: ['p'], | ||
metavar: 'same-commit-policy', | ||
parser: (policy) => { | ||
return availablePolicies.includes(policy) | ||
? cliparse.parsers.success(policy) | ||
: cliparse.parsers.error(`The output policy must be one of ${availablePolicies.join(', ')}`); | ||
}, | ||
default: 'error', | ||
description: `Which policy to apply when the local commit is the same as the remote one. Available policies are (${availablePolicies.join(', ')})`, | ||
complete () { | ||
return cliparse.autocomplete.words(availablePolicies); | ||
}, | ||
}); | ||
} | ||
|
||
module.exports = { | ||
getOutputFormatOption, | ||
getSameCommitPolicyOption, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.