class Remind101::Command::Groups
manage groups
Public Instance Methods
create()
click to toggle source
groups:create [NAME] create a new group -c, --code CODE # the group code (optional)
Examples
$ remind101 groups:create "Math 101" -c math101
# File lib/remind101/command/groups.rb, line 39 def create name = shift_argument validate_arguments! attributes = { class_name: name } attributes[:code] = options[:code] if options[:code] group = action "Creating #{name}" do remind101.create_group! attributes end hputs([ group.name, group.class_name ].join(" | ")) end
destroy()
click to toggle source
groups:destroy [CODE] permanently destroy a group
Example:
$ remind101 groups:destroy math101 Destroying math101... done
# File lib/remind101/command/groups.rb, line 62 def destroy code = shift_argument group = remind101.groups.find { |g| g.name == code } error("Unable to find a group with that code") if group.nil? message = "WARNING: Potentially Destructive Action\nThis command will destroy @#{code} (#{group.class_name})." if confirm_command(code, message) action("Destroying @#{code} (#{group.class_name})") do remind101.destroy_group!(group.id) end end end
index()
click to toggle source
groups
list groups
# File lib/remind101/command/groups.rb, line 10 def index validate_arguments! groups = remind101.groups if groups.empty? display "You have no groups" else styled_header "My Groups" styled_array groups.map { |g| [ g.name, g.class_name ] } end end
info()
click to toggle source
groups:info [CODE]
show detailed group information
# File lib/remind101/command/groups.rb, line 26 def info end