module Abt::Docs
Public Class Methods
basic_examples()
click to toggle source
# File lib/abt/docs.rb, line 10 def basic_examples { "Getting started:" => { "abt pick harvest" => "Pick harvest task. This will likely stay the same throughout the project", "abt pick asana | abt start harvest" => "Pick asana task and start tracking time", "abt stop harvest" => "Stop time tracker", "abt track asana harvest" => "Continue tracking time, e.g., after a break", "abt finalize asana" => "Finalize the selected asana task" } } end
extended_examples()
click to toggle source
# File lib/abt/docs.rb, line 22 def extended_examples # rubocop:disable Metrics/MethodLength { "Tracking meetings (without switching current task setting):" => { "abt pick asana -d | abt track harvest" => "Track on asana meeting task", 'abt pick harvest -d | abt track harvest -c "Name of meeting"' => "Track on separate harvest-task" }, "Many commands output ARIs that can be piped into other commands:" => { "abt tasks asana | grep -i <name of task>" => nil, "abt tasks asana | grep -i <name of task> | abt start" => nil }, "Sharing ARIs:" => { "abt share" => "Print current asana and harvest ARIs on a single line", "abt share | pbcopy" => "Copy ARIs to clipboard (mac only)", "abt track <ARIs from coworker>" => "Start tracking on the task your coworker shared with you", "abt current <ARIs from coworker> | abt track" => "Set task as current, then start tracking" }, "One-off tracking on any project": { "abt pick asana -dc -- harvest -dc | abt track" => "Find a track any task on any project, without reusing/affecting previous settings", "abt pick asana harvest | abt track" => "Can be used instead of the above when outside a git repo" }, "Flags:" => { 'abt start harvest -c "comment"' => "Add command flags after ARIs", 'abt start harvest -c "comment" -- asana' => "Use -- to end a list of flags, so that it can be followed by another ARI", 'abt pick harvest | abt start -c "comment"' => "Flags placed directly after a command applies to the piped in ARI" } } end
providers()
click to toggle source
# File lib/abt/docs.rb, line 53 def providers @providers ||= begin providers = {} providers["Global"] = global_command_definitions Abt.schemes.sort.each_with_object(providers) do |scheme, definition| definition[scheme] = command_definitions(scheme) end providers end end
Private Class Methods
command_definitions(scheme)
click to toggle source
# File lib/abt/docs.rb, line 81 def command_definitions(scheme) provider = Abt.scheme_provider(scheme) provider.command_names.each_with_object({}) do |name, definition| command_class = provider.command_class(name) full_name = "abt #{name} #{scheme}" if command_class.respond_to?(:usage) && command_class.respond_to?(:description) definition[full_name] = [command_class.usage.strip, command_class.description.strip] end end end
global_command_definitions()
click to toggle source
# File lib/abt/docs.rb, line 69 def global_command_definitions global_command_names = Abt::Cli::GlobalCommands.command_names global_command_names.each_with_object({}) do |name, definition| command_class = Abt::Cli::GlobalCommands.command_class(name) full_name = "abt #{name}" if command_class.respond_to?(:usage) && command_class.respond_to?(:description) definition[full_name] = [command_class.usage.strip, command_class.description.strip] end end end