66require_relative "infrastructure/storage/sql"
77require_relative "infrastructure/shell_interface"
88
9- module Pod
9+ module Podrb
1010 class CLI < Thor
1111 # https://github.com/rails/thor/issues/728#issuecomment-642798887
1212 def self . exit_on_failure?
@@ -16,102 +16,102 @@ def self.exit_on_failure?
1616 def self . start ( given_args = ARGV , config = { } )
1717 command = given_args . first
1818 does_not_require_config = %w[ version -V --version init ] . include? ( command )
19- pod_initialized = Dir . exist? ( ENV [ "HOME" ] + "/.config/pod " )
20- if does_not_require_config || pod_initialized
19+ podrb_initialized = Dir . exist? ( ENV [ "HOME" ] + "/.config/podrb " )
20+ if does_not_require_config || podrb_initialized
2121 super
2222 else
23- puts "Missing config files. Run `pod init` first."
23+ puts "Missing config files. Run `podrb init` first."
2424 end
2525 end
2626
27- desc "version" , "Displays the pod version"
27+ desc "version" , "Displays the podrb version"
2828 map %w[ -V --version ] => :version
2929 def version
3030 puts VERSION
3131 end
3232
33- desc "init" , "Creates the pod config files"
33+ desc "init" , "Creates the podrb config files"
3434 def init
3535 puts "Creating config files..."
3636
37- result = Pod ::Commands ::Init ::Runner . call
37+ result = Podrb ::Commands ::Init ::Runner . call
3838
39- puts Pod ::Commands ::Init ::Output . call ( result )
39+ puts Podrb ::Commands ::Init ::Output . call ( result )
4040 end
4141
42- desc "add FEED" , "Adds a podcast to the Pod database"
43- method_option :sync_url , type : :string , default : "" , desc : "Pod will use this URL to sync the podcast."
42+ desc "add FEED" , "Adds a podcast to the Podrb database"
43+ method_option :sync_url , type : :string , default : "" , desc : "Podrb will use this URL to sync the podcast."
4444 def add ( feed )
4545 puts "Adding the podcast..."
4646
47- result = Pod ::Commands ::Add ::Runner . call ( feed , options )
47+ result = Podrb ::Commands ::Add ::Runner . call ( feed , options )
4848
49- puts Pod ::Commands ::Add ::Output . call ( result )
49+ puts Podrb ::Commands ::Add ::Output . call ( result )
5050 end
5151
5252 desc "podcasts" , "List the podcast records"
5353 method_option :fields , type : :array , default : [ ] , desc : "Select the fields that will be displayed."
5454 def podcasts
55- result = Pod ::Commands ::Podcasts ::Runner . call ( options )
55+ result = Podrb ::Commands ::Podcasts ::Runner . call ( options )
5656
57- puts Pod ::Commands ::Podcasts ::Output . call ( result )
57+ puts Podrb ::Commands ::Podcasts ::Output . call ( result )
5858 end
5959
6060 desc "episodes PODCAST_ID" , "List the podcast episodes"
6161 method_option :fields , type : :array , default : [ ] , desc : "Select the fields that will be displayed."
62- method_option :order_by , type : :string , default : "id" , desc : "Choose how pod will order the episodes."
62+ method_option :order_by , type : :string , default : "id" , desc : "Choose how podrb will order the episodes."
6363 method_option :all , type : :boolean , default : false , desc : "List archived episodes too."
6464 def episodes ( podcast_id )
65- result = Pod ::Commands ::Episodes ::Runner . call ( podcast_id , options )
65+ result = Podrb ::Commands ::Episodes ::Runner . call ( podcast_id , options )
6666
67- puts Pod ::Commands ::Episodes ::Output . call ( result )
67+ puts Podrb ::Commands ::Episodes ::Output . call ( result )
6868 end
6969
7070 desc "open EPISODE_ID" , "Open a episode in the browser"
7171 method_option :browser , type : :string , default : "firefox" , desc : "Choose the browser."
7272 method_option :archive , type : :boolean , default : false , desc : "Archive the episode."
7373 def open ( episode_id )
74- result = Pod ::Commands ::Open ::Runner . call ( episode_id , options )
74+ result = Podrb ::Commands ::Open ::Runner . call ( episode_id , options )
7575
7676 Infrastructure ::ShellInterface . call ( result [ :metadata ] )
7777
78- puts Pod ::Commands ::Open ::Output . call ( result )
78+ puts Podrb ::Commands ::Open ::Output . call ( result )
7979 end
8080
8181 desc "archive EPISODE_ID" , "Archive the episode"
8282 def archive ( episode_id )
83- result = Pod ::Commands ::Archive ::Runner . call ( episode_id )
83+ result = Podrb ::Commands ::Archive ::Runner . call ( episode_id )
8484
85- puts Pod ::Commands ::Archive ::Output . call ( result )
85+ puts Podrb ::Commands ::Archive ::Output . call ( result )
8686 end
8787
8888 desc "dearchive EPISODE_ID" , "Dearchive the episode."
8989 def dearchive ( episode_id )
90- result = Pod ::Commands ::Dearchive ::Runner . call ( episode_id )
90+ result = Podrb ::Commands ::Dearchive ::Runner . call ( episode_id )
9191
92- puts Pod ::Commands ::Dearchive ::Output . call ( result )
92+ puts Podrb ::Commands ::Dearchive ::Output . call ( result )
9393 end
9494
95- desc "delete PODCAST_ID" , "Delete the podcast from pod 's database."
95+ desc "delete PODCAST_ID" , "Delete the podcast from podrb 's database."
9696 def delete ( podcast_id )
97- result = Pod ::Commands ::Delete ::Runner . call ( podcast_id )
97+ result = Podrb ::Commands ::Delete ::Runner . call ( podcast_id )
9898
99- puts Pod ::Commands ::Delete ::Output . call ( result )
99+ puts Podrb ::Commands ::Delete ::Output . call ( result )
100100 end
101101
102102 desc "sync PODCAST_ID" , "Sync the podcast."
103103 def sync ( podcast_id )
104- result = Pod ::Commands ::Sync ::Runner . call ( podcast_id )
104+ result = Podrb ::Commands ::Sync ::Runner . call ( podcast_id )
105105
106- puts Pod ::Commands ::Sync ::Output . call ( result )
106+ puts Podrb ::Commands ::Sync ::Output . call ( result )
107107 end
108108
109109 desc "update PODCAST_ID" , "Update the podcast attributes."
110110 method_option :feed , type : :string , default : "" , desc : "Define the podcast feed."
111111 def update ( podcast_id )
112- result = Pod ::Commands ::Update ::Runner . call ( podcast_id , options )
112+ result = Podrb ::Commands ::Update ::Runner . call ( podcast_id , options )
113113
114- puts Pod ::Commands ::Update ::Output . call ( result )
114+ puts Podrb ::Commands ::Update ::Output . call ( result )
115115 end
116116 end
117117end
0 commit comments