Class: SecretKeys::CLI::Init
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#format, #initialize, #parse_additional_options, #secrets
Constructor Details
This class inherits a constructor from SecretKeys::CLI::Base
Instance Method Details
#action_name ⇒ Object
161 162 163 |
# File 'lib/secret_keys/cli.rb', line 161 def action_name "init" end |
#run! ⇒ Object
165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'lib/secret_keys/cli.rb', line 165 def run! @secrets = SecretKeys.new({}, secret_key) if input.is_a?(String) if File.exist?(input) warn "Error: Cannot init preexisting file '#{input}'" warn "You may want to try calling `secret_keys encrypt/edit` instead" exit 1 end File.write(input, encrypted_file_contents) else $stdout.write(encrypted_file_contents) end end |