Class: Termrc::Cli
- Inherits:
-
Thor
- Object
- Thor
- Termrc::Cli
- Includes:
- Thor::Actions
- Defined in:
- lib/termrc/cli.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/termrc/cli.rb', line 17 def create if (File.exist? '.termrc' or File.exists? 'Termfile') say_this "Error: 'Termfile' already exists!" return else say_this "Creating Termfile...", :yellow FileUtils.cp TERMRC_TEMPLATE, 'Termfile' say_this "Success! \n", :yellow say_this "Now run your new Termfile file by calling `termrc start`", :blue end end |
#list(folder = '.') ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/termrc/cli.rb', line 31 def list(folder='.') folder_description = folder == "." ? 'current folder' : "'#{folder}'" say_this "Looking for termrc files in #{folder_description}:", :yellow a = `find #{folder} -name ".termrc" -o -name "Termfile"` say_this a say_this "None found.", :red if a.length < 1 end |
#start(file = 'Termfile') ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/termrc/cli.rb', line 42 def start(file='Termfile') file = '.termrc' unless File.exists?(file) if !File.exist? file say_this "Could not find Termfile! Did you run `termrc create`?", :red say_this "Did you run `termrc init`?", :yellow return elsif file == '.termrc' say_this "Using deprecated #{file} file...", :yellow end say_this "Starting termrc using: '#{file}'", :blue say_this "Please wait until all panes have fully launched!", :red begin Termrc::Base.new( File.(file) ) rescue Exception => e say_this "Error while starting termrc:", :red say_this e.to_s end end |