module Columbus3::CommandSyntax
Public Class Methods
commands()
click to toggle source
return a hash with all the commands and their options
# File lib/columbus3/cli/command_syntax.rb, line 6 def self.commands h = Hash.new self.methods.each do |method| if method.to_s.include?("_opts") then h = h.merge(eval(method.to_s)) end end return h end
Private Class Methods
console_opts()
click to toggle source
# File lib/columbus3/cli/command_syntax.rb, line 38 def self.console_opts opts = Slop::Options.new opts.banner = "console [options] -- Enter the console" help = <<EOS NAME #{opts.banner} SYNOPSYS #{opts.to_s} DESCRIPTION Invoke a console, from which you can more easily run columbus3 commands. EXAMPLES columbus3 console columbus3:000> process 11010101.CSV columbus3:001> show 11010101.CSV columbus3:002> EOS return { :console => [opts, :console, help] } end
convert_opts()
click to toggle source
# File lib/columbus3/cli/command_syntax.rb, line 251 def self.convert_opts opts = Slop::Options.new opts.banner = "convert track -- convert a GPX into a set of CSV files" opts.boolean "--force", "Force rewriting of the csv files, even if they already exist" help = <<EOS NAME #{opts.banner} SYNOPSYS #{opts.to_s} DESCRIPTION Convert a GPX track to a CSV track The command is useful if you are using different loggers for generating your tracks: columbus3 convert file.gpx will generate file-1.csv file-2.csv ... one per track in the GPX file. EXAMPLES columbus3 convert track.gpx BUGS AND LIMITATIONS The Columbus V900 format has fields with fixed width, and uses ^@ as a filler. The CSV file generated by the convert command generates fields of variable width (standard CSV files, I dare say). The heading field is not computed and the field is filled with -1. EOS return { convert: [opts, :convert, help] } end
graph_opts()
click to toggle source
# File lib/columbus3/cli/command_syntax.rb, line 230 def self.graph_opts opts = Slop::Options.new opts.banner = "graph [--filename filename] [--force] track -- plot speed and height profile of track" opts.boolean "--force", "Force rewriting of the js file, even if it already exists" help = <<EOS NAME #{opts.banner} SYNOPSYS #{opts.to_s} DESCRIPTION Plot speed and height profile of a single track. EXAMPLES columbus3 graph 11010101.CSV EOS return { graph: [opts, :graph, help] } end
help_opts()
click to toggle source
# File lib/columbus3/cli/command_syntax.rb, line 80 def self.help_opts opts = Slop::Options.new opts.banner = "help [command] -- print usage string" help = <<EOS NAME #{opts.banner} SYNOPSYS #{opts.to_s} DESCRIPTION Print help about a command EXAMPLES columbus3 help columbus3 help process EOS return { :help => [opts, :help, help] } end
man_opts()
click to toggle source
# File lib/columbus3/cli/command_syntax.rb, line 61 def self.man_opts opts = Slop::Options.new opts.banner = "man -- print a manual page" help = <<EOS NAME #{opts.banner} SYNOPSYS #{opts.to_s} DESCRIPTION Print the README file of this gem EXAMPLES columbus3 man EOS return { :man => [opts, :man, help] } end
process_opts()
click to toggle source
# File lib/columbus3/cli/command_syntax.rb, line 100 def self.process_opts opts = Slop::Options.new opts.banner = "process [track ...] -- generate sidecar files for given tracks" opts.boolean "-f", "--force", "Overwrite existing sidecar file" help = <<EOS NAME #{opts.banner} SYNOPSYS #{opts.to_s} DESCRIPTION Generate a sidecar file for the track(s) passed as input. Once created a sidecar file usually does not need to be regenerated. You can use the `--force` option to cause the sidecar file to be rewritten. EXAMPLES columbus3 process 11010101.CSV 11010201.CSV columbus3 process * EOS return { process: [opts, :process, help] } end
search_opts()
click to toggle source
# File lib/columbus3/cli/command_syntax.rb, line 124 def self.search_opts opts = Slop::Options.new opts.banner = "search [-r] [--dir directory] [--fields fields] query -- search for tracks matching query" opts.boolean "--debug", "Show how the query is processed" opts.boolean "-r", "--recurse", "Recurse in subdirectories" opts.string "-d", "--dir", "Directory to search (default to current directory)" opts.array "--fields", "Comma separated list of fields to print" help = <<EOS NAME #{opts.banner} SYNOPSYS #{opts.to_s} DESCRIPTION Search a directory for tracks matching your search criteria. By default columbus3 searches in the current dir; use the `--dir` option to choose a different directory. Use `--recurse` to recurce in subdirectories as well. Use `--fields` to choose what information is displayed in the output. Terms you can search for: location, start_location, end_location date, start_date, end_date year duration max_speed min_height max_height Numerical operators: <, <=, ==, >=, > String operators (locations): ~ (contains), == (is exactly) Complex Terms: Use "and" and "or" to build complex queries Examples of simple searches 'location ~ "USA"' any track whose start or end location contains USA 'date > 2015-02-14' any track whose start or end date is after Feb 14, 2015 'year == 2015' any track whose start or end date is in 2015 'duration <= 01:02:03' any track with a duration of less than 1h, 2min, and 3secs 'max_speed > 120' any track with a max speed greater than 120 km/h 'min_height == 10' any track with a min height lower than 10 meters Examples of complex searches 'location ~ "USA" and start_date >= 2015-01-01' tracks in the USA after or on Jan 1, 2015 'start_location ~ "Trenton" and end_location ~ "New York"' trips from Trenton to New York List of supported fields in the output list: yaml -> full pathname of the YAML metadata file path -> full pathname of the CSV file filename -> basename of the CSV file start_location -> start location end_location -> end location start_date -> start date (and time) end_date -> end date (and time) duration -> duration in seconds min_speed -> minimum speed in km/h max_speed -> maximum speed in km/h min_height -> minimum height in meters max_height -> maximum height in meters EXAMPLES columbus3 search 'location ~ "USA"' columbus3 search 'location ~ "USA" and speed < 10' --fields path | columbus3 show EOS return { search: [opts, :search, help] } end
show_opts()
click to toggle source
# File lib/columbus3/cli/command_syntax.rb, line 207 def self.show_opts opts = Slop::Options.new opts.banner = "show [--filename filename] [--force] [track ...] -- view one or more tracks (use stdin if no track)" opts.string "-f", "--filename=", "Output filename (default is _show.html)" opts.boolean "--force", "Force rewriting of the js file, even if it already exists" help = <<EOS NAME #{opts.banner} SYNOPSYS #{opts.to_s} DESCRIPTION Generate an html file which shows the track on a map. EXAMPLES columbus3 show 11010101.CSV 11010201.CSV columbus3 search 'location ~ "USA" and speed < 10' --fields path | columbus3 show --filename "us_tracks.html" EOS return { show: [opts, :show, help] } end
version_opts()
click to toggle source
# File lib/columbus3/cli/command_syntax.rb, line 18 def self.version_opts opts = Slop::Options.new opts.banner = "version -- print version information" help = <<EOS NAME #{opts.banner} SYNOPSYS #{opts.to_s} DESCRIPTION return version information EXAMPLES columbus3 version columbus3 version #{VERSION} EOS return { :version => [opts, :version, help] } end