Class: MiGA::Cli::Action::Find
- Inherits:
-
MiGA::Cli::Action
- Object
- MiGA
- MiGA::Cli::Action
- MiGA::Cli::Action::Find
- Defined in:
- lib/miga/cli/action/find.rb
Instance Attribute Summary
Attributes inherited from MiGA::Cli::Action
Instance Method Summary collapse
Methods inherited from MiGA::Cli::Action
#complete, #empty_action, #initialize, #launch, load, #name
Constructor Details
This class inherits a constructor from MiGA::Cli::Action
Instance Method Details
#parse_cli ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/miga/cli/action/find.rb', line 7 def parse_cli cli.defaults = { add: false, ref: true } cli.parse do |opt| cli.opt_object(opt, [:project, :dataset_type]) opt.on( '-a', '--add', 'Register the datasets found', 'By default, only lists them (dry run)' ) { |v| cli[:add] = v } opt.on( '-q', '--query', 'Register datasets as query' ) { |v| cli[:ref] = !v } opt.on( '-u', '--user STRING', 'Owner of the dataset.' ) { |v| cli[:user] = v } opt.on( '-m', '--metadata STRING', 'Metadata as key-value pairs separated by = and delimited by comma', 'Values are saved as strings except for booleans (true / false) or nil' ) { |v| cli[:metadata] = v } end end |
#perform ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/miga/cli/action/find.rb', line 32 def perform p = cli.load_project ud = p.unregistered_datasets ud.each do |dn| cli.puts dn if cli[:add] cli.say "Registering: #{dn}" d = Dataset.new(p, dn, cli[:ref]) cli.(d) p.add_dataset(dn) res = d.first_preprocessing(true) cli.say "- #{res}" end end end |