Add -A CLI flag to show all tasks
This commit is contained in:
1 parent
ea66501311
commit
59f1a89f4f
3 files changed
+33
-5
No files matched your search
@@ -54,12 +54,14 @@ module Rscons
|
||||
# List of task(s) to execute.
|
||||
# @param show_tasks [Boolean]
|
||||
# Flag to show tasks and exit.
|
||||
# @param all_tasks [Boolean]
|
||||
# Flag to show all tasks (not just those with a description).
|
||||
# @param enabled_variants [String]
|
||||
# User-specified variants list.
|
||||
#
|
||||
# @return [Integer]
|
||||
# Process exit code (0 on success).
|
||||
def run(rsconscript, tasks_and_params, show_tasks, enabled_variants)
|
||||
def run(rsconscript, tasks_and_params, show_tasks, all_tasks, enabled_variants)
|
||||
Cache.instance["failed_commands"] = []
|
||||
@enabled_variants = enabled_variants
|
||||
if enabled_variants == "" && !tasks_and_params.include?("configure")
|
||||
@@ -71,7 +73,7 @@ module Rscons
|
||||
@script.load(rsconscript)
|
||||
enable_variants
|
||||
if show_tasks
|
||||
show_script_tasks
|
||||
show_script_tasks(all_tasks)
|
||||
return 0
|
||||
end
|
||||
apply_task_params(tasks_and_params)
|
||||
@@ -340,10 +342,10 @@ module Rscons
|
||||
end
|
||||
end
|
||||
|
||||
def show_script_tasks
|
||||
def show_script_tasks(all_tasks)
|
||||
puts "Tasks:"
|
||||
Task[].sort.each do |task_name, task|
|
||||
if task.description
|
||||
if task.description || all_tasks
|
||||
puts %[ #{sprintf("%-27s", task_name)} #{task.description}]
|
||||
task.params.each do |param_name, param|
|
||||
arg_text = "--#{param_name}"
|
||||
|
||||
+7
-1
@@ -54,10 +54,15 @@ module Rscons
|
||||
def run_toplevel(argv)
|
||||
rsconscript = nil
|
||||
show_tasks = false
|
||||
all_tasks = false
|
||||
enabled_variants = ""
|
||||
|
||||
OptionParser.new do |opts|
|
||||
|
||||
opts.on("-A", "--all") do
|
||||
all_tasks = true
|
||||
end
|
||||
|
||||
opts.on("-b", "--build DIR") do |build_dir|
|
||||
Rscons.application.build_dir = build_dir
|
||||
end
|
||||
@@ -132,7 +137,7 @@ module Rscons
|
||||
end
|
||||
|
||||
begin
|
||||
Rscons.application.run(rsconscript, tasks_and_params, show_tasks, enabled_variants)
|
||||
Rscons.application.run(rsconscript, tasks_and_params, show_tasks, all_tasks, enabled_variants)
|
||||
rescue RsconsError => e
|
||||
Ansi.write($stderr, :red, e.message, :reset, "\n")
|
||||
1
|
||||
@@ -144,6 +149,7 @@ module Rscons
|
||||
Usage: #{$0} [global options] [[task] [task options] ...]
|
||||
|
||||
Global options:
|
||||
-A, --all Show all tasks (even without descriptions) in task list
|
||||
-b BUILD, --build=BUILD Set build directory (default: build)
|
||||
-e VS, --variants=VS Enable or disable variants
|
||||
-f FILE Use FILE as Rsconscript
|
||||
|
||||
Reference in new issue
Block a user