Skip to content

Commit

Permalink
BUGFIX: Specify the latest option during the CLI initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
Inkdpixels committed Aug 30, 2017
1 parent 9f38165 commit 1314830
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/commands/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ module.exports = async (opts: {tags: Array<string>, image: string, arg: string,
const url = tags[0];
let versionTags = tags;

['image', 'tags', 'arg'].forEach(key => {
const value = opts[key];

if (!value) {
throw new Error('Please specify a --tags option to the CLI.');
}
});

if (typeof url === 'string' && isUrl(url)) {
const res = await fetch(url);
const json = await res.json();
Expand Down
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ cli
.option('--tags <url | Array<string>>', 'The JSON array to parse or the GitHub API URL which points to a repositories tags.', val => val.split(','))
.option('--image <string>', 'The docker image name to use as a base.')
.option('--arg <string>', 'The build-arg key which will be used to.')
.option('--latest <string>', 'The tag/version to pass into the docker build when building your latest image, defaults to "latest".')
.description('Uses/Fetches the given tags, filters out release only tags based on semver and builds/pushes the docker images.')
.version(pkg.version)
.parse(process.argv);

if (cli.rawArgs.length !== 3) {
if (!cli.rawArgs.length) {
cli.help();
process.exit(0);
}
Expand Down

0 comments on commit 1314830

Please sign in to comment.