Top Level Namespace

Defined Under Namespace

Modules: Annotation, Association, AssociationItem, Entity, EntityWorkflow, FWTAdapter, Filtered, LSF, MultipleResult, NamedArray, Open, PBS, PKIAdapter, Path, Persist, SLURM, SchedulerJob, Scout, ScoutCabinet, ScoutSemaphore, ScoutTKRZW, ShardAdapter, TKAdapter, TSV, TSVAdapter, Task, Workflow Classes: CmdStop, DoneProcessing, DryRun, FixWidthTable, KnowledgeBase, PackedIndex, Sharder, Step, TaskNotFound, WorkQueue, WorkerException

Instance Method Summary collapse

Instance Method Details

#aliasesObject



195
196
197
# File 'bin/scout', line 195

def aliases
  @aliases ||= Scout.etc.cmd_alias.exists? ? Scout.etc.cmd_alias.yaml : {}
end

#cmd_aliasObject



207
208
209
210
211
# File 'bin/scout', line 207

def cmd_alias
  while ARGV[0] && aliases.include?(ARGV[0])
    ARGV.replace tokenize_cmd_params(aliases[ARGV[0]]) + ARGV[1..-1]
  end
end

#commands(prev) ⇒ Object



145
146
147
148
149
150
151
# File 'bin/scout', line 145

def commands(prev)
    scout_command_dir = prev_dir(prev)

    command_file_dirs = scout_command_dir.find_all
    command_files = command_file_dirs.collect{|d| d.glob('*') }.flatten
    command_files.collect{|p| File.basename(p) }.uniq.reject{|p| p =~ /\.desc$/}.sort
end

#prev_dir(prev) ⇒ Object



135
136
137
138
139
140
141
142
143
# File 'bin/scout', line 135

def prev_dir(prev)
    scout_command_dir = $scout_command_dir

    prev.each do |previous_command|
        scout_command_dir = scout_command_dir[previous_command]
    end

    scout_command_dir
end


182
183
184
185
186
187
188
189
190
191
192
193
# File 'bin/scout', line 182

def print_error(error, backtrace = nil)
  puts Log.color :magenta, "## ERROR"
  puts
  if backtrace
    puts Log.color :red, "Backtrace: "
    puts
    puts Log.color_stack(backtrace.reverse) * "\n"
    puts
  end
  puts Log.color :red, error
  puts
end

#scout_usage(prev = nil) ⇒ Object Also known as: usage



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# File 'bin/scout', line 153

def scout_usage(prev = nil)
  puts SOPT.doc

  if prev
    puts
    puts Log.color :magenta, "## COMMANDS"
    puts
    puts Log.color :magenta, "Command:"
    puts 
    puts "  #{File.basename($0)} #{prev * " "}"
    puts 
    puts Log.color :magenta, "Subcommands:"
    puts 
    prev_dir = prev_dir(prev)
    commands(prev).each do |command|
      directory = File.directory? prev_dir[command].find
      if directory
        puts "  " << Log.color(:blue, command)
      else
        puts "  " << command
      end
    end
  end
  puts
  true
end

#tokenize_cmd_params(str) ⇒ Object



199
200
201
202
203
204
205
# File 'bin/scout', line 199

def tokenize_cmd_params(str)
 return str if Array === str
 str.scan(/
          (?:["']([^"']*?)["']) |
          ([^"'\s]+)
          /x).flatten.compact
end