diff --git a/bin/crew b/bin/crew index e8a53e823..7bbbfa1ca 100755 --- a/bin/crew +++ b/bin/crew @@ -91,12 +91,16 @@ end String.use_color = args['--color'] || !args['--no-color'] @opt_force = args['--force'] +@opt_json = args['--json'] @opt_keep = args['--keep'] -@opt_source = args['--source'] @opt_recursive = args['--recursive-build'] +@opt_source = args['--source'] +@opt_update = args['--update-package-files'] @opt_version = args['--version'] # Verbose options +@json = @opt_json ? '-j' : '' +@update = @opt_update ? '-u' : '' @verbose = CREW_VERBOSE ? 'v' : '' @short_verbose = CREW_VERBOSE ? '-v' : '' @@ -1935,7 +1939,7 @@ def upstream_command(args) # Pass the whole argument input to tools/version.rb, stripping out any file extensions that occur as a result of using a wildcard argument in a directory where it matches files. args = { '' => args.split } if args.is_a? String Dir.chdir CREW_PACKAGES_PATH do - system "../tools/version.rb #{args[''].join(' ').gsub('.rb', '')} #{@short_verbose}" + system "../tools/version.rb #{args[''].join(' ').gsub('.rb', '')} #{@json} #{@update} #{@short_verbose}" end end diff --git a/commands/help.rb b/commands/help.rb index 5ecdecf69..57f546634 100644 --- a/commands/help.rb +++ b/commands/help.rb @@ -156,7 +156,9 @@ class Command when 'upstream' puts <<~EOT Check if an upstream version is available for package(s). - Usage: crew upstream [-v|--verbose] [ ...] + Usage: crew upstream [-j|--json|-u|--update-package-files|-v|--verbose] [ ...] + If `-j` or `--json` is present, output will be in json format. + If `-u` or `--update-package-files` is present, it will attempt to update the package version. If `-v` or `--verbose` is present, extra information will be displayed. EOT when 'version' diff --git a/lib/const.rb b/lib/const.rb index 7f06aad19..0b1eec950 100644 --- a/lib/const.rb +++ b/lib/const.rb @@ -406,22 +406,24 @@ CREW_DOCOPT ||= <<~DOCOPT crew update_package_file [options] [-v|--verbose] [ ...] crew upgrade [options] [-f|--force] [-k|--keep] [-s|--source] [-v|--verbose] [ ...] crew upload [options] [-f|--force] [-v|--verbose] [ ...] - crew upstream [options] [-v|--verbose] [ ...] + crew upstream [options] [-j|--json|-u|--update-package-files|-v|--verbose] ... crew whatprovides [options] ... - -b --include-build-deps Include build dependencies in output. - -c --color Use colors even if standard out is not a tty. - -d --no-color Disable colors even if standard out is a tty. - -D --debug Enable debugging. - -f --force Force where relevant. - -h --help Show this screen. - -k --keep Keep the `CREW_BREW_DIR` (#{CREW_BREW_DIR}) directory. - -L --license Display the crew license. - -s --source Build or download from source even if pre-compiled binary exists. - -S --recursive-build Build from source, including all dependencies, even if pre-compiled binaries exist. - -t --tree Print dependencies in a tree-structure format. - -v --verbose Show extra information. - -V --version Display the crew version. + -b --include-build-deps Include build dependencies in output. + -c --color Use colors even if standard out is not a tty. + -d --no-color Disable colors even if standard out is a tty. + -D --debug Enable debugging. + -f --force Force where relevant. + -h --help Show this screen. + -j --json Display output in json format. + -k --keep Keep the `CREW_BREW_DIR` (#{CREW_BREW_DIR}) directory. + -L --license Display the crew license. + -s --source Build or download from source even if pre-compiled binary exists. + -S --recursive-build Build from source, including all dependencies, even if pre-compiled binaries exist. + -t --tree Print dependencies in a tree-structure format. + -u --update-package-files Attempt to update the package version. + -v --verbose Show extra information. + -V --version Display the crew version. DOCOPT # All available crew commands.