Class: Tagm::Cli
- Inherits:
-
Thor
- Object
- Thor
- Tagm::Cli
- Defined in:
- lib/tagm/cli.rb
Instance Method Summary collapse
- #create_db ⇒ Object
- #merge ⇒ Object
- #on(node = nil) ⇒ Object
- #tag(node) ⇒ Object
- #tagged(tags = []) ⇒ Object
- #untag(node) ⇒ Object
Instance Method Details
#create_db ⇒ Object
53 54 55 56 |
# File 'lib/tagm/cli.rb', line 53 def create_db puts "Creating database at #{Config::DB_PATH_VAR}" Tagm::Db.create_database! end |
#merge ⇒ Object
47 48 49 50 |
# File 'lib/tagm/cli.rb', line 47 def merge Db.merge(from: [:from], into: [:into]) puts "Merged \"#{options[:from].sort.join('", "')}\" into \"#{options[:into]}\"" end |
#on(node = nil) ⇒ Object
30 31 32 33 34 |
# File 'lib/tagm/cli.rb', line 30 def on(node = nil) path = resolve_path(node) path, node end |
#tag(node) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/tagm/cli.rb', line 13 def tag(node) path = resolve_path node Db.tag node: path, tags: [:tags] path, node end |
#tagged(tags = []) ⇒ Object
37 38 39 40 41 42 |
# File 'lib/tagm/cli.rb', line 37 def tagged( = []) paths = Db.list(*) paths.each_pair do |path, list| puts "#{path}: #{colorize(list).join(', ')}" end end |
#untag(node) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/tagm/cli.rb', line 22 def untag(node) path = resolve_path node Db.untag node: path, tags: [:tags] path, node end |