lib/eco/cli/config/default/options.rb in eco-helpers-2.0.19 vs lib/eco/cli/config/default/options.rb in eco-helpers-2.0.21

- old
+ new

@@ -16,10 +16,16 @@ "You may specify the usecase to know its specific options by: -usecase_name --help -options" ].join("\n") unless hpf || hif || ho || huc exit end + desc = "Redirect Standard Ouput to file" + options_set.add("-stdout", desc) do |options, session| + file = SCR.get_arg("-stdout", with_param: true) || "output.txt" + STDOUT.reopen(file, "w+") + end + desc = "Fix the current session to work with this schema" options_set.add("-schema-id", desc) do |options, session| sch_name = SCR.get_arg("-schema-id", with_param: true) sch_id = session.schemas.to_id(sch_name) @@ -39,17 +45,39 @@ desc += "It can also be useful to obtain `-get-partial` of people base on `:export` use cases (i.e. -people-to-csv)" options_set.add("-entries-from", desc) do |options, session| options.deep_merge!(input: {entries_from: true}) end + desc = "Used to only get the people from the input file. It will also include their current and new supervisors." + options_set.add("-get-partial", desc) do |options, session| + options.deep_merge!(people: { + get: {from: :remote, type: :partial} + }) + end + + desc = "Do not load any people for this run." + options_set.add("-no-people", desc) do |options, session| + options.deep_merge!(people: {get: false}) + end + desc = "Locally cache all the people manager by retrieving from the server" options_set.add("-get-people", desc) do |options, session| options.deep_merge!(people: { get: {from: :remote, type: :full} }) end - options_set.add(["-dry-run", "-simulate"], "Runs in dry-run (no requests sent to server)") do |options, session| + desc = "Used to specify the cache file of people to be used. " + desc += "It is useful to use as people reference those stored in cached file diffrent to the last one." + options_set.add("-people-from-backup", desc) do |options, session| + file = SCR.get_file("-people-from-backup", required: true, should_exist: true) + options.deep_merge!(people: { + get: {from: :local, type: :file, file: file} + }) + end + + desc = "Runs in dry-run (no requests sent to server)" + options_set.add(["-dry-run", "-simulate"], desc) do |options, session| options[:dry_run] = true options[:simulate] = true session.config.dry_run! end