Sha256: 5e337385b59eaba22bc910594b200a9fd842df5f08fa38c8d14c2082aacd966d

Contents?: true

Size: 750 Bytes

Versions: 4

Compression:

Stored size: 750 Bytes

Contents

#!/usr/bin/env ruby

require 'vman'
require 'fileutils'
require 'tty-prompt'

@stty_save = `stty -g`.chomp

def save_and_exit
  puts
  system('stty', @stty_save)
  exit
end

trap('INT') { save_and_exit }

begin
  if ARGV[0] == 'configure'
    prompt = TTY::Prompt.new
    config_path = Vman::Client.const_get(:DEFAULT_CONFIG_PATH)
    if File.exist?(config_path)
      prompt.warn("Configuration file already exists at #{config_path}. No changes have been made.")
    else
      FileUtils.copy('.vman.example.json', config_path)
      prompt.ok("Vman configuration file created at #{config_path}. Edit this file with your correct values")
    end
  else
    Vman::Client.new(ARGV)
  end
rescue TTY::Prompt::Reader::InputInterrupt
  save_and_exit
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vman-0.1.3 bin/vman
vman-0.1.2 bin/vman
vman-0.1.1 bin/vman
vman-0.1.0 bin/vman