Class: MiGA::Cli::Action::Files

Inherits:
MiGA::Cli::Action show all
Defined in:
lib/miga/cli/action/files.rb

Constant Summary

Constants included from MiGA

MiGA::CITATION, VERSION, VERSION_DATE, VERSION_NAME

Instance Attribute Summary

Attributes inherited from MiGA::Cli::Action

#cli

Attributes included from MiGA::Common::Net

#remote_connection_uri

Instance Method Summary collapse

Methods inherited from MiGA::Cli::Action

#complete, #empty_action, #initialize, #launch, load, #name

Methods inherited from MiGA

CITATION, CITATION_ARRAY, DEBUG, DEBUG_OFF, DEBUG_ON, DEBUG_TRACE_OFF, DEBUG_TRACE_ON, FULL_VERSION, LONG_VERSION, VERSION, VERSION_DATE, #advance, debug?, debug_trace?, initialized?, #like_io?, #num_suffix, rc_path, #result_files_exist?, #say

Methods included from MiGA::Common::Path

#root_path, #script_path

Methods included from MiGA::Common::Format

#clean_fasta_file, #seqs_length, #tabulate

Methods included from MiGA::Common::Net

#download_file_ftp, #http_request, #known_hosts, #main_server, #net_method, #normalize_encoding, #remote_connection

Methods included from MiGA::Common::SystemCall

#run_cmd, #run_cmd_opts

Constructor Details

This class inherits a constructor from MiGA::Cli::Action

Instance Method Details

#parse_cliObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/miga/cli/action/files.rb', line 7

def parse_cli
  cli.defaults = { details: false, json: true }
  cli.parse do |opt|
    cli.opt_object(opt, [:project, :dataset_opt])
    opt.on(
      '-i', '--info',
      'Print additional details for each file'
    ) { |v| cli[:details] = v }
    opt.on(
      '--[no-]json',
      'Include (or not) JSON files containing results metadata',
      'JSON files are included by default'
    ) { |v| cli[:json] = v }
  end
end

#performObject



23
24
25
26
27
28
29
30
# File 'lib/miga/cli/action/files.rb', line 23

def perform
  cli.load_project_or_dataset.each_result do |sym, res|
    cli.puts "#{"#{sym}\tjson\t" if cli[:details]}#{res.path}" if cli[:json]
    res.each_file do |k, f|
      cli.puts "#{"#{sym}\t#{k}\t" if cli[:details]}#{res.dir}/#{f}"
    end
  end
end