Class: Til::Cli

Inherits:
Thor
  • Object
show all
Defined in:
lib/til/cli.rb

Instance Method Summary collapse

Instance Method Details

#ag(*args) ⇒ Object



81
82
83
# File 'lib/til/cli.rb', line 81

def ag(*args)
  Til.run_ag_command(*args)
end

#cat(subject = nil) ⇒ Object



62
63
64
65
66
67
68
# File 'lib/til/cli.rb', line 62

def cat(subject=nil)
  if subject
    Til.print_all_notes_in(subject)
  else
    Til.print_all_notes
  end
end

#configObject



18
19
20
# File 'lib/til/cli.rb', line 18

def config
  Til.config_settings_file_and_notes_repo
end

#edit(keyword = "") ⇒ Object



30
31
32
# File 'lib/til/cli.rb', line 30

def edit(keyword="")
  Til.edit_file(keyword, options)
end

#git(*args) ⇒ Object



71
72
73
# File 'lib/til/cli.rb', line 71

def git(*args)
  Til.run_git_command(*args)
end

#githubObject



23
24
25
# File 'lib/til/cli.rb', line 23

def github
  Til.open_github_page_for_repo
end

#grep(*args) ⇒ Object



76
77
78
# File 'lib/til/cli.rb', line 76

def grep(*args)
  Til.run_grep_command(*args)
end

#last(quantity = 1) ⇒ Object



57
58
59
# File 'lib/til/cli.rb', line 57

def last(quantity=1)
  Til.print_most_recent_note quantity.to_i
end

#ls(subject = nil) ⇒ Object



41
42
43
44
45
46
47
48
49
# File 'lib/til/cli.rb', line 41

def ls(subject = nil)
  if options[:subjects]
    Til.list_subjects
  elsif subject
    Til.list_notes_in(subject)
  else
    Til.list_all_notes
  end
end

#new(subject, title) ⇒ Object



35
36
37
# File 'lib/til/cli.rb', line 35

def new(subject, title)
  Til.new_note(subject, title)
end

#pwdObject



52
53
54
# File 'lib/til/cli.rb', line 52

def pwd
  Til.print_working_directory
end

#rm(keyword) ⇒ Object



86
87
88
# File 'lib/til/cli.rb', line 86

def rm(keyword)
  Til.remove_file(keyword)
end

#versionObject



12
13
14
15
# File 'lib/til/cli.rb', line 12

def version
  require "til/version.rb"
  say "til_cli #{Til::VERSION}"
end