Module: Bioroebe::CommandlineArguments
- Includes:
- ColoursForBase
- Included in:
- CommandlineApplication, GUI::UniversalWidgets::Alignment, GUI::UniversalWidgets::AminoacidComposition, GUI::UniversalWidgets::AntiSenseStrand, GUI::UniversalWidgets::BlosumMatrixViewer, GUI::UniversalWidgets::CalculateCellNumbersOfBacteria, GUI::UniversalWidgets::Controller, GUI::UniversalWidgets::DnaToAminoacidWidget, GUI::UniversalWidgets::DnaToReverseComplementWidget, GUI::UniversalWidgets::FastaTableWidget, GUI::UniversalWidgets::FormatConverter, GUI::UniversalWidgets::Gene, GUI::UniversalWidgets::HammingDistance, GUI::UniversalWidgets::LevenstheinDistance, GUI::UniversalWidgets::NucleotideAnalyser, GUI::UniversalWidgets::ParsePdbFile, GUI::UniversalWidgets::PrimerDesignWidget, GUI::UniversalWidgets::RandomSequence, GUI::UniversalWidgets::RestrictionEnzymes, GUI::UniversalWidgets::ShowCodonTable, GUI::UniversalWidgets::ShowCodonUsage, GUI::UniversalWidgets::Sizeseq, GUI::UniversalWidgets::ThreeToOne, GUI::UniversalWidgets::WwwFinder, ShowNucleotideSequence
- Defined in:
- lib/bioroebe/base/commandline_application/commandline_arguments.rb
Overview
Bioroebe::CommandlineArguments
Constant Summary
Bioroebe::ColoursForBase::ARRAY_HTML_COLOURS_IN_USE
Instance Method Summary
collapse
-
#commandline_arguments? ⇒ Boolean
# === commandline_arguments?.
-
#commandline_arguments_that_are_files? ⇒ Boolean
# === commandline_arguments_that_are_files?.
-
#e(i = '') ⇒ Object
# === e ========================================================================= #.
-
#first? ⇒ Boolean
(also: #first_argument?, #first_argument, #input_file?, #first_commandline_argument?)
# === first? ========================================================================= #.
-
#first_non_hyphen_argument? ⇒ Boolean
(also: #first_non_hyphened_argument?)
# === first_non_hyphen_argument? ========================================================================= #.
-
#remove_hyphens_from_the_commandline_arguments(i = @commandline_arguments) ⇒ Object
(also: #remove_hyphens_from)
# === remove_hyphens_from_the_commandline_arguments ========================================================================= #.
-
#return_commandline_arguments_as_string ⇒ Object
# === return_commandline_arguments_as_string.
-
#return_commandline_arguments_that_are_not_files ⇒ Object
# === return_commandline_arguments_that_are_not_files.
-
#return_entries_without_two_leading_hyphens(i = @commandline_arguments) ⇒ Object
(also: #return_commandline_arguments_without_hyphen, #reject_hyphens, #non_hyphened_commandline_arguments?)
# === return_entries_without_two_leading_hyphens.
-
#select_commandline_arguments(i = @commandline_arguments) ⇒ Object
# === select_commandline_arguments.
-
#select_entries_starting_with_two_hyphens(i = commandline_arguments? ) ⇒ Object
(also: #return_commandline_arguments_starting_with_hyphens, #return_entries_with_two_leading_hyphens_from, #return_arguments_with_leading_hyphens, #return_commandline_arguments_starting_with_two_hyphens, #commandline_arguments_with_leading_hyphens?, #commandline_arguments_containing_hyphens?, #commandline_arguments_containing_leading_hyphens?, #commandline_arguments_with_two_leading_hyphens, #commandline_arguments_starting_with_leading_hyphens?, #commandline_arguments_starting_with_a_hyphen?, #commandline_arguments_starting_with_a_hyphen, #select_two_hyphens_from)
# === select_entries_starting_with_two_hyphens.
-
#set_commandline_arguments(i = ARGV) ⇒ Object
# === set_commandline_arguments.
#colourize_this_aminoacid_sequence_for_the_commandline, #colourize_this_nucleotide_sequence, #disable_colours, #ecomment, #efancy, #egold, #enable_colours, #eorange, #eparse, #erev, #red, #remove_trailing_escape_part, #return_colour_for_nucleotides, #rev, #sdir, #set_will_we_use_colours, #sfancy, #sfile, #simp, #swarn, #use_colours?, #use_colours_within_the_bioroebe_namespace?
Instance Method Details
#commandline_arguments? ⇒ Boolean
#
commandline_arguments?
Query method to obtain all commandline arguments given to this class.
#
38
39
40
|
# File 'lib/bioroebe/base/commandline_application/commandline_arguments.rb', line 38
def commandline_arguments?
@commandline_arguments
end
|
#commandline_arguments_that_are_files? ⇒ Boolean
#
commandline_arguments_that_are_files?
This method will select the entries that are a file (which must exist locally).
#
58
59
60
|
# File 'lib/bioroebe/base/commandline_application/commandline_arguments.rb', line 58
def commandline_arguments_that_are_files?
@commandline_arguments.select {|entry| File.file?(entry.to_s) }
end
|
#e(i = '') ⇒ Object
18
19
20
|
# File 'lib/bioroebe/base/commandline_application/commandline_arguments.rb', line 18
def e(i = '')
puts i
end
|
#first? ⇒ Boolean
Also known as:
first_argument?, first_argument, input_file?, first_commandline_argument?
45
46
47
|
# File 'lib/bioroebe/base/commandline_application/commandline_arguments.rb', line 45
def first?
@commandline_arguments.first
end
|
#first_non_hyphen_argument? ⇒ Boolean
Also known as:
first_non_hyphened_argument?
#
first_non_hyphen_argument?
#
106
107
108
|
# File 'lib/bioroebe/base/commandline_application/commandline_arguments.rb', line 106
def first_non_hyphen_argument?
return_entries_without_two_leading_hyphens.first
end
|
#remove_hyphens_from_the_commandline_arguments(i = @commandline_arguments) ⇒ Object
Also known as:
remove_hyphens_from
#
remove_hyphens_from_the_commandline_arguments
#
88
89
90
91
92
|
# File 'lib/bioroebe/base/commandline_application/commandline_arguments.rb', line 88
def remove_hyphens_from_the_commandline_arguments(
i = @commandline_arguments
)
i.reject! {|entry| entry.start_with? '--' }
end
|
#return_commandline_arguments_as_string ⇒ Object
#
return_commandline_arguments_as_string
This method will return the commandline arguments as a String.
#
99
100
101
|
# File 'lib/bioroebe/base/commandline_application/commandline_arguments.rb', line 99
def return_commandline_arguments_as_string
@commandline_arguments.join(' ').strip
end
|
#return_commandline_arguments_that_are_not_files ⇒ Object
#
return_commandline_arguments_that_are_not_files
This method will grab all entries that are NOT files.
#
67
68
69
|
# File 'lib/bioroebe/base/commandline_application/commandline_arguments.rb', line 67
def return_commandline_arguments_that_are_not_files
@commandline_arguments.reject {|entry| File.file?(entry.to_s) }
end
|
#return_entries_without_two_leading_hyphens(i = @commandline_arguments) ⇒ Object
Also known as:
return_commandline_arguments_without_hyphen, reject_hyphens, non_hyphened_commandline_arguments?
#
return_entries_without_two_leading_hyphens
This variant will return all entries WITHOUT leading hyphens.
#
142
143
144
145
146
|
# File 'lib/bioroebe/base/commandline_application/commandline_arguments.rb', line 142
def return_entries_without_two_leading_hyphens(
i = @commandline_arguments
)
i.reject {|entry| entry.start_with? '--' }
end
|
#select_commandline_arguments(i = @commandline_arguments) ⇒ Object
#
select_commandline_arguments
This method can be used to select commandline arguments that begin with – hyphens.
#
77
78
79
80
81
82
83
|
# File 'lib/bioroebe/base/commandline_application/commandline_arguments.rb', line 77
def select_commandline_arguments(
i = @commandline_arguments
)
i.select {|entry|
entry.start_with? '--'
}
end
|
#select_entries_starting_with_two_hyphens(i = commandline_arguments?
) ⇒ Object
Also known as:
return_commandline_arguments_starting_with_hyphens, return_entries_with_two_leading_hyphens_from, return_arguments_with_leading_hyphens, return_commandline_arguments_starting_with_two_hyphens, commandline_arguments_with_leading_hyphens?, commandline_arguments_containing_hyphens?, commandline_arguments_containing_leading_hyphens?, commandline_arguments_with_two_leading_hyphens, commandline_arguments_starting_with_leading_hyphens?, commandline_arguments_starting_with_a_hyphen?, commandline_arguments_starting_with_a_hyphen, select_two_hyphens_from
#
select_entries_starting_with_two_hyphens
This entry can, specifically, be used to filter out proper commandline arguments from an Array (such as ARGV).
#
116
117
118
119
120
121
122
123
124
|
# File 'lib/bioroebe/base/commandline_application/commandline_arguments.rb', line 116
def select_entries_starting_with_two_hyphens(
i = commandline_arguments?
)
if i.respond_to? :select
i.select {|entry| entry.to_s.start_with? '--' } else
[]
end
end
|
#set_commandline_arguments(i = ARGV) ⇒ Object
#
set_commandline_arguments
This method can be used to set the commandline arguments, which usually refers to ARGV.
#
28
29
30
31
|
# File 'lib/bioroebe/base/commandline_application/commandline_arguments.rb', line 28
def set_commandline_arguments(i = ARGV)
i = [i].flatten.compact
@commandline_arguments = i
end
|