Add and document options to upstream command (#12459)

This commit is contained in:
Ed Reel
2025-08-14 18:34:54 -05:00
committed by GitHub
parent 1bea49b965
commit 7a00a045fb
3 changed files with 25 additions and 17 deletions

View File

@@ -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 = { '<name>' => args.split } if args.is_a? String
Dir.chdir CREW_PACKAGES_PATH do
system "../tools/version.rb #{args['<name>'].join(' ').gsub('.rb', '')} #{@short_verbose}"
system "../tools/version.rb #{args['<name>'].join(' ').gsub('.rb', '')} #{@json} #{@update} #{@short_verbose}"
end
end

View File

@@ -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] [<package1> <package2> ...]
Usage: crew upstream [-j|--json|-u|--update-package-files|-v|--verbose] [<package1> <package2> ...]
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'

View File

@@ -406,22 +406,24 @@ CREW_DOCOPT ||= <<~DOCOPT
crew update_package_file [options] [-v|--verbose] [<name> ...]
crew upgrade [options] [-f|--force] [-k|--keep] [-s|--source] [-v|--verbose] [<name> ...]
crew upload [options] [-f|--force] [-v|--verbose] [<name> ...]
crew upstream [options] [-v|--verbose] [<name> ...]
crew upstream [options] [-j|--json|-u|--update-package-files|-v|--verbose] <name> ...
crew whatprovides [options] <pattern> ...
-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.