lib/autoproj/cli/main.rb in autoproj-2.3.1 vs lib/autoproj/cli/main.rb in autoproj-2.4.0
- old
+ new
@@ -20,11 +20,22 @@
class_option :color, type: :boolean, default: TTY::Color.color?,
desc: 'enables or disables colored display (enabled by default if the terminal supports it)'
class_option :progress, type: :boolean, default: TTY::Color.color?,
desc: 'enables or disables progress display (enabled by default if the terminal supports it)'
+ stop_on_unknown_option! :exec
+ check_unknown_options! except: :exec
+
no_commands do
+ def default_report_on_package_failures
+ if options[:debug]
+ :raise
+ else
+ :exit
+ end
+ end
+
def run_autoproj_cli(filename, classname, report_options, *args, **extra_options)
require "autoproj/cli/#{filename}"
if Autobuild::Subprocess.transparent_mode = options[:tool]
Autobuild.silent = true
Autobuild.color = false
@@ -137,11 +148,11 @@
option :mainline, type: :string,
desc: "compare to the given baseline. if 'true', the comparison will ignore any override, otherwise it will take into account overrides only up to the given package set"
option :auto_exclude, type: :boolean,
desc: 'if true, packages that fail to import will be excluded from the build'
def update(*packages)
- report_options = Hash[silent: false, on_package_failures: :exit]
+ report_options = Hash[silent: false, on_package_failures: default_report_on_package_failures]
if options[:auto_exclude]
report_options[:on_package_failures] = :report
end
run_autoproj_cli(:update, :Update, report_options, *packages)
@@ -177,11 +188,11 @@
option :tool, type: :boolean,
desc: "act as a build tool, transparently passing the subcommand's outputs to STDOUT"
option :confirm, type: :boolean, default: nil,
desc: '--force and --rebuild will ask confirmation if applied to the whole workspace. Use --no-confirm to disable this confirmation'
def build(*packages)
- report_options = Hash[silent: false, on_package_failures: :exit]
+ report_options = Hash[silent: false, on_package_failures: default_report_on_package_failures]
if options[:auto_exclude]
report_options[:on_package_failures] = :report
end
run_autoproj_cli(:build, :Build, Hash[silent: false].merge(report_options), *packages)
@@ -190,12 +201,14 @@
desc 'cache CACHE_DIR', 'create or update a cache directory that can be given to AUTOBUILD_CACHE_DIR'
option :keep_going, aliases: :k,
desc: 'do not stop on errors'
option :checkout_only, aliases: :c, type: :boolean, default: false,
desc: "only checkout packages, do not update already-cached ones"
- def cache(*cache_dir)
- run_autoproj_cli(:cache, :Cache, Hash[], *cache_dir)
+ option :all, type: :boolean, default: true,
+ desc: "cache all defined packages (the default) or only the selected ones"
+ def cache(*args)
+ run_autoproj_cli(:cache, :Cache, Hash[], *args)
end
desc 'clean [PACKAGES]', 'remove build byproducts for the given packages'
long_desc <<-EODESC
Remove build byproducts from disk
@@ -441,9 +454,15 @@
desc 'exec', "runs a command, applying the workspace's environment first"
def exec(*args)
require 'autoproj/cli/exec'
CLI::Exec.new.run(*args)
+ end
+
+ desc 'which', "resolves the full path to a command within the Autoproj workspace"
+ def which(cmd)
+ require 'autoproj/cli/which'
+ CLI::Which.new.run(cmd)
end
end
end
end