Sha256: 3b06a3c8297d483dcd58f8523be195487d9836bf6c16ab5b41d7f45f7a742d39

Contents?: true

Size: 1.55 KB

Versions: 10

Compression:

Stored size: 1.55 KB

Contents

desc "List things, such as tasks or contexts"
long_desc %(
  List a whole lot of things that you might be keeping track of 
  in your overall todo list.

  This is your go-to place or finding all of the things that you
  might have 
  stored in 
  your todo databases.
)

command [:list] do |c|
  c.default_command :tasks

  c.desc "Show long form"
  c.switch [:l,:long]

  c.flag :required_flag, :required => true
  c.flag :required_flag2, :required => true

  c.desc "List tasks"
  c.long_desc %(
    Lists all of your tasks that you have, in varying orders, and
    all that stuff.  Yes, this is long, but I need a long description.
  )

  c.arg :task, [:optional, :multiple]
  c.command :tasks do |tasks|
    tasks.desc "blah blah crud x whatever"
    tasks.flag [:x], :must_match => Array

    tasks.flag :flag

    tasks.action do |global,options,args|
      puts options[:x].inspect
      puts "list tasks: #{args.join(',')}"
    end

    tasks.desc 'list open tasks'
    tasks.command :open do |open|
      open.action do |global,options,args|
        puts "tasks open"
      end
    end

    tasks.default_desc 'list all tasks'
  end

  c.desc "List contexts"
  c.long_desc %(
    Lists all of your contexts, which are places you might be 
    where you can do stuff and all that.
  )
  c.command :contexts do |contexts|

    contexts.desc "Foobar"
    contexts.switch [:f,'foobar']

    contexts.desc "Blah"
    contexts.switch [:b]

    contexts.flag :otherflag

    contexts.action do |global,options,args|
      puts "list contexts: #{args.join(',')}"
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
gli-2.14.0 test/apps/todo/lib/todo/commands/list.rb
gli-2.13.4 test/apps/todo/lib/todo/commands/list.rb
gli-2.13.3 test/apps/todo/lib/todo/commands/list.rb
gli-2.13.2 test/apps/todo/lib/todo/commands/list.rb
gli-2.13.1 test/apps/todo/lib/todo/commands/list.rb
gli-2.13.0 test/apps/todo/lib/todo/commands/list.rb
gli-2.12.3 test/apps/todo/lib/todo/commands/list.rb
gli-2.12.2 test/apps/todo/lib/todo/commands/list.rb
gli-2.12.1 test/apps/todo/lib/todo/commands/list.rb
gli-2.12.0 test/apps/todo/lib/todo/commands/list.rb