Sha256: e2678e875e04f79670ce5cbc86c7f5a13170237e366e6b2834e2ddfcadad9102

Contents?: true

Size: 503 Bytes

Versions: 10

Compression:

Stored size: 503 Bytes

Contents

name = next_arg("Please specify the key name")
if name !~ /[a-zA-Z0-9]+/
  $stderr.puts "Not a valid key name (letters and numbers only)"
  exit 1
end

key = $stdin.read.strip
if key !~ /(ssh-rsa|ssh-dsa) ([a-zA-Z0-9\+\/]+[=]*)/
  $stderr.puts "Not a valid key"
  exit 1
end

type = $1
value = $2

dirname = File.join(find_account_dir(@username), "keys")
FileUtils.mkdir_p(dirname)
filename = File.join(dirname, name)
File.open(filename, "w") do |file|
  file << type << " " << value    
end

sync_keys

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
hubbard-0.0.9 commands/add-key.rb
hubbard-0.0.8 commands/add-key.rb
hubbard-0.0.7 commands/add-key.rb
hubbard-0.0.6 commands/add-key.rb
hubbard-0.0.5 commands/add-key.rb
hubbard-0.0.4 commands/add-key.rb
hubbard-0.0.3 commands/add-key.rb
hubbard-0.0.2 commands/add-key.rb
hubbard-0.0.1 commands/add-key.rb
hubbard-0.0.0 commands/add-key.rb