go2dir 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +33 -14
- data/bin/{go2dir.rb → go2dir} +0 -0
- data/go2dir.gemspec +3 -3
- data/lib/go2dir.rb +17 -5
- data/lib/go2dir/version.rb +1 -1
- metadata +7 -7
data/README.md
CHANGED
@@ -1,29 +1,48 @@
|
|
1
1
|
# Go2dir
|
2
2
|
|
3
|
-
|
3
|
+
Are you trying to become a bash ninja? Then, stop typing over and over again the same paths to the same directories!
|
4
|
+
go2dir lets you create shortcuts for your most used paths and change lightning fast your current directory.
|
4
5
|
|
5
6
|
## Installation
|
6
7
|
|
7
|
-
|
8
|
+
*Important:* when calling this gem from your cli, it executes in a different process, so running it alone won't take any effect on your current location. For this to work, you need to let your bash evaluate the output commands. I wrote the code myself and use it everyday, but I advise you to check out the code first and make sure you're comfortable with this.
|
8
9
|
|
9
|
-
|
10
|
+
After that, you can install it by running:
|
10
11
|
|
11
|
-
|
12
|
+
$ gem install go2dir
|
12
13
|
|
13
|
-
|
14
|
+
next you *must* add this function to your .bashrc:
|
14
15
|
|
15
|
-
|
16
|
+
function gt() { eval $(go2dir $1 $2); }
|
16
17
|
|
17
|
-
|
18
|
+
and reload your bash.
|
19
|
+
Note: you can change <gt> for whatever command you want to use.
|
18
20
|
|
19
21
|
## Usage
|
20
22
|
|
21
|
-
|
23
|
+
To add or edit a shortcut:
|
24
|
+
|
25
|
+
$ gt <shortcut> <path>
|
26
|
+
|
27
|
+
To use shortcut:
|
28
|
+
|
29
|
+
$ gt <shortcut>
|
30
|
+
|
31
|
+
## Example
|
32
|
+
|
33
|
+
$ gt projects ~/Projects/
|
34
|
+
Shorctcut saved sucessfully!
|
35
|
+
$ gt projects
|
36
|
+
$ pwd
|
37
|
+
/Users/brunohq/Projects/
|
38
|
+
$ gt hidden-porn /Users/brunohq/really/long/path/to/your/xxx/video/collection/muhahah/
|
39
|
+
Shorctcut saved sucessfully!
|
40
|
+
$ gt hidden-porn
|
41
|
+
$ pwd
|
42
|
+
/Users/brunohq/really/long/path/to/your/xxx/video/collection/muhahah/
|
22
43
|
|
23
|
-
##
|
44
|
+
## Suggestions
|
45
|
+
This gem built for my personal use only, but if you feel it could be improved or if you have any suggestions, holla at me.
|
24
46
|
|
25
|
-
|
26
|
-
|
27
|
-
3. Commit your changes (`git commit -am 'Added some feature'`)
|
28
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
-
5. Create new Pull Request
|
47
|
+
With love,
|
48
|
+
[@brunohq](http://twitter.com/brunohq)
|
data/bin/{go2dir.rb → go2dir}
RENAMED
File without changes
|
data/go2dir.gemspec
CHANGED
@@ -5,9 +5,9 @@ Gem::Specification.new do |gem|
|
|
5
5
|
gem.authors = ["Bruno Costa"]
|
6
6
|
gem.email = ["bruno.costa@hardquarters.com"]
|
7
7
|
gem.summary = "go2dir is a shorcut manager to speed up your command line cding"
|
8
|
-
gem.description = "Are you
|
9
|
-
same directories
|
10
|
-
lightning fast your current directory."
|
8
|
+
gem.description = "Are you trying to become a bash ninja? Then, stop typing over
|
9
|
+
and over again the same paths to the same directories! go2dir lets you create shortcuts
|
10
|
+
for your most used paths and change lightning fast your current directory."
|
11
11
|
|
12
12
|
gem.homepage = "https://github.com/brunohq/go2dir"
|
13
13
|
|
data/lib/go2dir.rb
CHANGED
@@ -7,19 +7,31 @@ module Go2dir
|
|
7
7
|
|
8
8
|
def execute(*args)
|
9
9
|
return help if args.empty?
|
10
|
-
return
|
11
|
-
return
|
10
|
+
return get_path(args[0]) if args.length == 1
|
11
|
+
return set_shortcut(args[0], args[1]) if args.length == 2
|
12
12
|
end
|
13
13
|
|
14
|
-
def
|
14
|
+
def get_path(shortcut)
|
15
15
|
shortcuts = Go2dir::Storage.load
|
16
|
-
|
16
|
+
if shortcuts.has_key?(shortcut)
|
17
|
+
puts "cd #{shortcuts[shortcut]}"
|
18
|
+
else
|
19
|
+
puts "echo 'This shortcut is not defined!'"
|
20
|
+
end
|
17
21
|
end
|
18
22
|
|
19
|
-
def
|
23
|
+
def set_shortcut(shortcut, path)
|
20
24
|
shortcuts = Go2dir::Storage.load
|
21
25
|
shortcuts[shortcut] = path
|
22
26
|
Go2dir::Storage.save(shortcuts)
|
27
|
+
puts "echo 'Shortcut saved sucessfully!'"
|
28
|
+
end
|
29
|
+
|
30
|
+
def help
|
31
|
+
puts "echo 'To add or edit a shortcut:';"
|
32
|
+
puts "echo '\ $ gt <shortcut> <path>';"
|
33
|
+
puts "echo 'To use shortcut:';"
|
34
|
+
puts "echo '\ $ gt <shortcut>';"
|
23
35
|
end
|
24
36
|
|
25
37
|
end
|
data/lib/go2dir/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: go2dir
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,15 +9,15 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-14 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
|
-
description: ! "Are you
|
15
|
-
|
16
|
-
|
14
|
+
description: ! "Are you trying to become a bash ninja? Then, stop typing over \n and
|
15
|
+
over again the same paths to the same directories! go2dir lets you create shortcuts
|
16
|
+
\n for your most used paths and change lightning fast your current directory."
|
17
17
|
email:
|
18
18
|
- bruno.costa@hardquarters.com
|
19
19
|
executables:
|
20
|
-
- go2dir
|
20
|
+
- go2dir
|
21
21
|
extensions: []
|
22
22
|
extra_rdoc_files: []
|
23
23
|
files:
|
@@ -26,7 +26,7 @@ files:
|
|
26
26
|
- LICENSE
|
27
27
|
- README.md
|
28
28
|
- Rakefile
|
29
|
-
- bin/go2dir
|
29
|
+
- bin/go2dir
|
30
30
|
- go2dir.gemspec
|
31
31
|
- lib/go2dir.rb
|
32
32
|
- lib/go2dir/storage.rb
|