Sha256: bacef0bbc3b07736b489e03a1d433b2de994c4c5b2e4a073a02af2b6b098bca9
Contents?: true
Size: 1.02 KB
Versions: 2
Compression:
Stored size: 1.02 KB
Contents
module Intent module Commands class Projects < Base def run(args, output) if args.empty? print_help(output) else case args.first.to_sym when :help print_help(output) when :list documents.projects.all.each do |task| output.puts task.highlight_as_project end when :add then add_project(args, output) when :sync then sync_project(args, output) else raise Errors:COMMAND_NOT_FOUND end end end private def add_project(args, output) prompt = TTY::Prompt.new name = prompt.ask('Project identifier: ') name = name.downcase.gsub("_", "-").gsub(" ", "-").gsub(/[^0-9a-z\-]/i, '') name = "+#{name}" unless name.start_with?('+') output.puts name end def sync_project(args, output) result = documents.projects.sync! output.puts "Sync projects result: #{result}" end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
intent-0.8.1 | lib/intent/commands/projects.rb |
intent-0.8.0 | lib/intent/commands/projects.rb |