Class: Memo::Cli::Command::Setup
- Inherits:
-
Object
- Object
- Memo::Cli::Command::Setup
- Defined in:
- lib/memo/cli/command/setup.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(_, os: Memo::OS.new) ⇒ Setup
constructor
A new instance of Setup.
Constructor Details
Instance Method Details
#call ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/memo/cli/command/setup.rb', line 13 def call toml = <<~TOML [config] # ext = "md" # root = "~/.memo" # editor = "vim" # preview = "bat" # fuzzy_finder = "fzf --preview 'bat --color=always {}'" # default_filename = "memo" # default_namespace = "mymemo" [namespace_alias] # p1 = "project1" [command_alias] # ep1 = "edit memo -n project1" TOML if ::File.exist? @config.path puts "WARNING: config file already exists" puts print "reset config? (y/n) " ans = STDIN.gets.chomp if ans != "y" puts "aborted" return end end @os.write @config.path, toml puts puts <<~TEXT Create config file to #{@config.path} You can edit by `$ memo config` TEXT end |