sshp 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +0 -1
- data/README.md +3 -3
- data/bin/sshp +3 -1
- data/bin/sshp-alias +3 -0
- data/lib/sshp/alias.rb +2 -2
- data/lib/sshp/version.rb +1 -1
- metadata +1 -1
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -11,10 +11,10 @@ gem install sshp
|
|
11
11
|
To save an alias without hostname.
|
12
12
|
|
13
13
|
```sh
|
14
|
-
sshp-alias u -i ~/keys/my_key.pem -l ubuntu
|
14
|
+
sshp-alias u -i ~/keys/my_key.pem -l ubuntu
|
15
15
|
```
|
16
16
|
|
17
|
-
|
17
|
+
Then
|
18
18
|
|
19
19
|
```sh
|
20
20
|
sshp u hostname.com
|
@@ -24,7 +24,7 @@ To save an alias with hostname.
|
|
24
24
|
```sh
|
25
25
|
sshp-alias u -i ~/keys/my_key.pem -l ubuntu hostname.com
|
26
26
|
```
|
27
|
-
|
27
|
+
Then
|
28
28
|
|
29
29
|
```sh
|
30
30
|
sshp u
|
data/bin/sshp
CHANGED
data/bin/sshp-alias
CHANGED
@@ -8,7 +8,10 @@ require File.expand_path(File.join(File.dirname(__FILE__), %w[.. lib sshp alias]
|
|
8
8
|
if ARGV.any?
|
9
9
|
SSHP::Alias.create_or_update_by_name ARGV[0], ARGV[1..-1].join(" ")
|
10
10
|
puts "The alias #{ARGV[0]} was succefully saved"
|
11
|
+
else
|
12
|
+
puts "Usage: sshp-alias name [ssh options]"
|
11
13
|
end
|
14
|
+
|
12
15
|
puts "List of available aliases"
|
13
16
|
SSHP::Alias.all.each_pair do |name, value|
|
14
17
|
puts "#{name}: #{value} (To run `sshp #{name}`)"
|
data/lib/sshp/alias.rb
CHANGED
@@ -8,7 +8,7 @@ module SSHP
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.all
|
11
|
-
@all ||= YAML.load
|
11
|
+
@all ||= YAML.load(File.open filename, "r")["aliases"]
|
12
12
|
rescue Errno::ENOENT
|
13
13
|
@all = {}
|
14
14
|
end
|
@@ -20,7 +20,7 @@ module SSHP
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def self.save
|
23
|
-
File.open(filename, "w") { |f| f.write all.to_yaml }
|
23
|
+
File.open(filename, "w") { |f| f.write ({ "aliases" => all }).to_yaml }
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
data/lib/sshp/version.rb
CHANGED