Class: Til::Cli

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

Instance Method Summary collapse

Instance Method Details

#ag(*args) ⇒ Object



74
75
76
# File 'lib/til/cli.rb', line 74

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

#cat(subject = nil) ⇒ Object



55
56
57
58
59
60
61
# File 'lib/til/cli.rb', line 55

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

#edit(keyword = "") ⇒ Object



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

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

#git(*args) ⇒ Object



64
65
66
# File 'lib/til/cli.rb', line 64

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

#githubObject



16
17
18
# File 'lib/til/cli.rb', line 16

def github
  Til.open_github_page_for_repo
end

#grep(*args) ⇒ Object



69
70
71
# File 'lib/til/cli.rb', line 69

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

#initObject



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

def init
  Til.init_settings_file_and_notes_repo
end

#last(quantity = 1) ⇒ Object



50
51
52
# File 'lib/til/cli.rb', line 50

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

#ls(subject = nil) ⇒ Object



34
35
36
37
38
39
40
41
42
# File 'lib/til/cli.rb', line 34

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



28
29
30
# File 'lib/til/cli.rb', line 28

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

#pwdObject



45
46
47
# File 'lib/til/cli.rb', line 45

def pwd
  Til.print_working_directory
end

#rm(keyword) ⇒ Object



79
80
81
# File 'lib/til/cli.rb', line 79

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