warp-dir 1.6.0 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/rubocop.yml +27 -0
- data/.github/workflows/ruby.yml +27 -0
- data/.github/workflows/shellcheck.yml +18 -0
- data/.gitignore +1 -1
- data/.idea/runConfigurations/All_Specs.xml +6 -9
- data/.relaxed-rubocop-2.5.yml +153 -0
- data/.rspec +1 -0
- data/.rubocop.yml +40 -1154
- data/.rubocop_todo.yml +685 -0
- data/Gemfile +9 -0
- data/LICENSE +2 -2
- data/README.adoc +244 -0
- data/Rakefile +19 -61
- data/bin/console +5 -4
- data/bin/warp-dir.bash +220 -54
- data/exe/warp-dir +3 -2
- data/lib/warp/dir/app/cli.rb +5 -5
- data/lib/warp/dir/app/response.rb +8 -10
- data/lib/warp/dir/command/clean.rb +1 -1
- data/lib/warp/dir/command/help.rb +0 -1
- data/lib/warp/dir/command/install.rb +12 -15
- data/lib/warp/dir/command/ls.rb +3 -3
- data/lib/warp/dir/command.rb +2 -2
- data/lib/warp/dir/config.rb +1 -1
- data/lib/warp/dir/errors.rb +3 -0
- data/lib/warp/dir/formatter.rb +2 -2
- data/lib/warp/dir/point.rb +1 -2
- data/lib/warp/dir/serializer/dotfile.rb +1 -1
- data/lib/warp/dir/store.rb +2 -2
- data/lib/warp/dir/version.rb +23 -19
- data/lib/warp/dir.rb +6 -6
- data/warp-dir.gemspec +15 -9
- metadata +69 -23
- data/.atom-build.json +0 -22
- data/.codeclimate.yml +0 -22
- data/.travis.yml +0 -13
- data/Guardfile +0 -14
- data/README.md +0 -181
- data/ROADMAP.md +0 -96
data/README.md
DELETED
@@ -1,181 +0,0 @@
|
|
1
|
-
# Warp Directory
|
2
|
-
|
3
|
-
[![Downloads](http://ruby-gem-downloads-badge.herokuapp.com/warp-dir?type=total)](https://rubygems.org/gems/ven table)
|
4
|
-
[![Gem Version](https://badge.fury.io/rb/warp-dir.svg)](https://badge.fury.io/rb/warp-dir)
|
5
|
-
<br />
|
6
|
-
|
7
|
-
[![Build Status](https://travis-ci.org/kigster/warp-dir.svg?branch=master)](https://travis-ci.org/kigster/warp-dir)
|
8
|
-
[![Code Climate](https://codeclimate.com/github/kigster/warp-dir/badges/gpa.svg)](https://codeclimate.com/github/kigster/warp-dir)
|
9
|
-
[![Test Coverage](https://codeclimate.com/github/kigster/warp-dir/badges/coverage.svg)](https://codeclimate.com/github/kigster/warp-dir/coverage)
|
10
|
-
[![Issue Count](https://codeclimate.com/github/kigster/warp-dir/badges/issue_count.svg)](https://codeclimate.com/github/kigster/warp-dir)
|
11
|
-
|
12
|
-
<hr/>
|
13
|
-
[![Gitter](https://img.shields.io/gitter/room/gitterHQ/gitter.svg)](https://gitter.im/kigster/warp-dir)
|
14
|
-
<hr/>
|
15
|
-
|
16
|
-
This is a ruby implementation of the tool `wd` (warp directory),
|
17
|
-
[originally written as a `ZSH` module](https://github.com/mfaerevaag/wd)
|
18
|
-
by [Markus Færevaag](https://github.com/mfaerevaag).
|
19
|
-
|
20
|
-
I personaly went back to `bash` after trying out `ZSH`, but it was the `wd` plugin that I really missed.
|
21
|
-
|
22
|
-
While Markus kindly offered a ruby version in a [separate branch of this module](https://github.com/mfaerevaag/wd/tree/ruby),
|
23
|
-
it wasn't quite as extensible as I wanted to (or well tested), so it ended up being an inspiration for this gem.
|
24
|
-
|
25
|
-
## Warp This
|
26
|
-
|
27
|
-
WarpDir is a UNIX command line tool that works somewhat similar to the standard built-in command `cd` — "change directory".
|
28
|
-
|
29
|
-
The main difference is that `wd` is able to add/remove/list folder "shortcuts", and allows you to jump to these shortcuts from anywhere on the filesystem.
|
30
|
-
|
31
|
-
This of this as a folder-navigation super-charge tool that you'd use on a most frequently-used set of folders. This becomes __really useful__ if you are often finding youself going into a small number of deeply nested folders with a long path prefix.
|
32
|
-
|
33
|
-
## Installation
|
34
|
-
|
35
|
-
Three steps:
|
36
|
-
|
37
|
-
- `wd` requires a Ruby interpreter version 2.2 higher.
|
38
|
-
- Please Check your default ruby with `ruby --version`. You should see something like "ruby 2.3.0p0....".
|
39
|
-
- If you see version 1.9 or earlier, please upgrade your ruby using the package manager native to your OS.
|
40
|
-
- Install `warp-dir` ruby gem (note: you may need to prefix the command with `sudo` if you are installing into the "system" ruby namespace).
|
41
|
-
|
42
|
-
```bash
|
43
|
-
$ gem install warp-dir --no-ri --no-rdoc
|
44
|
-
```
|
45
|
-
|
46
|
-
- The last step is to install the `wd` BASH function and auto-completion. This step appends the required shell function to your shell initialization file, that is specified with the `--dotfile` flag.
|
47
|
-
|
48
|
-
```bash
|
49
|
-
$ warp-dir install --dotfile ~/.bash_profile
|
50
|
-
```
|
51
|
-
|
52
|
-
After the last step you __need to restart your session__, so – if you are on Mac OS X, – please reopen your Terminal or better yet – [iTerm2](https://www.iterm2.com/), and then type:
|
53
|
-
|
54
|
-
```bash
|
55
|
-
$ wd help
|
56
|
-
```
|
57
|
-
|
58
|
-
If the above command returns a properly formatted help that looks like the image below, your setup is now complete!
|
59
|
-
|
60
|
-
![Image](doc/wd-help.png?refresh=1)
|
61
|
-
|
62
|
-
|
63
|
-
## Usage
|
64
|
-
|
65
|
-
__NOTE:__ in the below examples, the characters `~ ❯ ` denote the current shell prompt, showing the current folder you are in. The command to type is on the right hand side of the "❯".
|
66
|
-
|
67
|
-
Let's first bookmark a long directory:
|
68
|
-
|
69
|
-
```bash
|
70
|
-
~ ❯ cd ~/workspace/arduino/robots/command-bridge/src
|
71
|
-
~/workspace/arduino/robots/command-bridge/src ❯ wd add cbsrc
|
72
|
-
Warp point saved!
|
73
|
-
|
74
|
-
~/workspace/arduino/robots/command-bridge/src ❯ cd ~/workspace/c++/foo/src
|
75
|
-
~/workspace/c++/foo/src ❯ wd add foosrc
|
76
|
-
Warp point saved!
|
77
|
-
|
78
|
-
~/workspace/c++/foo/src ❯ cd /usr/local/Cellar
|
79
|
-
/usr/local/Cellar ❯ wd add brew
|
80
|
-
Warp point saved!
|
81
|
-
```
|
82
|
-
|
83
|
-
Now we can list/inspect current set of warp points:
|
84
|
-
|
85
|
-
```bash
|
86
|
-
/usr/local/Cellar ❯ wd l
|
87
|
-
cbsrc -> ~/workspace/arduino/robots/command-bridge/src
|
88
|
-
foosrc -> ~/workspace/c++/foo/src
|
89
|
-
brew -> /usr/local/Cellar
|
90
|
-
```
|
91
|
-
|
92
|
-
Now we can jump around these warp points, as well as run 'ls' inside (even passing arbitrary arguments to the `ls` itself):
|
93
|
-
|
94
|
-
```bash
|
95
|
-
/usr/local/Cellar ❯ wd cbsrc
|
96
|
-
~/workspace/arduino/robots/command-bridge/src ❯ wd foosrc
|
97
|
-
~/workspace/c++/foo/src ❯ 1 wd ls brew -- -alF | head -4 # run ls -alF inside /usr/local/Cellar
|
98
|
-
total 0
|
99
|
-
drwxrwx--- 73 kig staff 2482 May 7 15:29 ./
|
100
|
-
drwxrwx--- 21 kig staff 714 Apr 28 11:40 ../
|
101
|
-
drwxrwx--- 3 kig staff 102 Dec 24 03:14 ack/
|
102
|
-
```
|
103
|
-
|
104
|
-
### Command Completion
|
105
|
-
|
106
|
-
If you installed `wd` properly, it should register it's own command completion for BASH and be ready for your tabs :)
|
107
|
-
|
108
|
-
Note that you can use `wd` to change directory by giving an absolute or relative directory name, just like `cd` (so not just using warp-points), so when you type `wd [TAB]` you will see all saved warp points as well as the local directories you can `cd` into.
|
109
|
-
|
110
|
-
That's basically it!
|
111
|
-
|
112
|
-
### Config File (aka. Warp Points Database)
|
113
|
-
|
114
|
-
All of the mappings are stored in the `~/.warprc` file, where the warp point name is followed by a colon, and the path it maps to. So it's trivial to do a global search/replace on that file in your favorite editor, if, for example, a commond top level folder had changed.
|
115
|
-
|
116
|
-
The format of the file was left identical to that of the `ZSH` version of `wd` so that one could switch back and force between the two versions of `wd` and still be able to use their collection of warp points.
|
117
|
-
|
118
|
-
See? I think we thought of everything :)
|
119
|
-
|
120
|
-
Happy warping!
|
121
|
-
|
122
|
-
|
123
|
-
## `wd` Concept
|
124
|
-
|
125
|
-
The overall concept comes from the realization that when we work on the command line, we often do things that `wd` tool provides straight out of the box, such as:
|
126
|
-
|
127
|
-
* we often have to deal with a limited number of folders at any given time
|
128
|
-
* on occastion have to jump between these folders (which we call __warp points__), which may require mult-level `cd` command, for example: `cd ~/workspace/foo/src/include/; ....; cd ~/Documents/Microsoft\ Word/; ...`
|
129
|
-
* seems like it should be easy to add, remove and list warp points
|
130
|
-
* everything should require typing few characters as possible :)
|
131
|
-
* it would be great to have full BASH completion support
|
132
|
-
|
133
|
-
Some future extensions could be based on some additional realizations:
|
134
|
-
|
135
|
-
* perhaps you might want to inspect a bookmarked folder without leaving your current place.
|
136
|
-
* maybe by inspecting we mean — running a `find`, or `ls` or any other command for that matter
|
137
|
-
|
138
|
-
### Notable Differences with original `wd`
|
139
|
-
|
140
|
-
* instead of `wd add!` use `wd add -f <point>` (or --force)
|
141
|
-
|
142
|
-
These features will be added shortly:
|
143
|
-
|
144
|
-
* for now `wd clean` is not supported
|
145
|
-
* for now history is not supported
|
146
|
-
* for now '-' is not supported
|
147
|
-
|
148
|
-
## Future Development
|
149
|
-
|
150
|
-
I have so many cool ideas about where this can go, that I created a
|
151
|
-
[dedicated page](ROADMAP.md) for the discussion of future features. Please head over
|
152
|
-
there if you'ld like to participate.
|
153
|
-
|
154
|
-
## Development
|
155
|
-
|
156
|
-
After checking out the repo, run `bin/setup` to install dependencies.
|
157
|
-
You can also run `bin/console` for an interactive prompt that will
|
158
|
-
allow you to experiment.
|
159
|
-
|
160
|
-
To install this gem onto your local machine, run `bundle exec rake install`.
|
161
|
-
To release a new version, update the version number in `version.rb`, and
|
162
|
-
then run `bundle exec rake release`, which will create a git tag for the
|
163
|
-
version, push git commits and tags, and push the `.gem` file
|
164
|
-
to [rubygems.org](https://rubygems.org).
|
165
|
-
|
166
|
-
## Adding New Commands
|
167
|
-
|
168
|
-
Just follow the patter in the `lib/warp/dir/commands/` folder, copy and modify
|
169
|
-
one of the existing commands. Command class name is used as an actual command.
|
170
|
-
|
171
|
-
## Contributing
|
172
|
-
|
173
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/kigster/warp-dir.
|
174
|
-
|
175
|
-
## Author
|
176
|
-
|
177
|
-
<p>© 2016 Konstantin Gredeskoul, all rights reserved.</p>
|
178
|
-
|
179
|
-
## License
|
180
|
-
|
181
|
-
This project is distributed under the [MIT License](https://raw.githubusercontent.com/kigster/warp-dir/master/LICENSE).
|
data/ROADMAP.md
DELETED
@@ -1,96 +0,0 @@
|
|
1
|
-
# Warp Directory – Future Roadmap
|
2
|
-
|
3
|
-
[![Gitter](https://img.shields.io/gitter/room/gitterHQ/gitter.svg)](https://gitter.im/kigster/warp-dir)
|
4
|
-
|
5
|
-
Here I'd like to document various ideas and feature requests from myself and others.
|
6
|
-
|
7
|
-
## Simplify Interface
|
8
|
-
|
9
|
-
Questionable value, but this sort of interface appear a bit more consistent.
|
10
|
-
|
11
|
-
Still I am not sure I want to type `wd -j proj` or `wd -a proj` instead of `wd proj` and `wd add proj`...
|
12
|
-
|
13
|
-
```bash
|
14
|
-
wd -j/--jump point
|
15
|
-
wd -a/--add point
|
16
|
-
wd -r/--remove point
|
17
|
-
wd -l/--ls point
|
18
|
-
wd -p/--path point
|
19
|
-
|
20
|
-
wd -L/--list
|
21
|
-
wd -C/--clean
|
22
|
-
wd -S/--scan # report whether points exist on the file system
|
23
|
-
```
|
24
|
-
|
25
|
-
## Run Commands In A Warp Point
|
26
|
-
|
27
|
-
Pass an arbitrary command to execute, and return back to CWD.
|
28
|
-
|
29
|
-
```bash
|
30
|
-
wd proj -x/--exec -- "command"
|
31
|
-
```
|
32
|
-
|
33
|
-
## Group Commands
|
34
|
-
|
35
|
-
Create a group of several warp points:
|
36
|
-
|
37
|
-
```bash
|
38
|
-
wd -g/--group group1 -d/--define "point1,point2,...,pointN"
|
39
|
-
wd -g/--group group1 -r/--remove point1 # remove a point from the group
|
40
|
-
wd -g/--group group1 -a/--add point1 # add a point to the group
|
41
|
-
```
|
42
|
-
|
43
|
-
Execute command in all warp points of the group:
|
44
|
-
|
45
|
-
```bash
|
46
|
-
wd -x/--exec [ -g/--group group ] [ -r/--return-code ] -- command
|
47
|
-
```
|
48
|
-
|
49
|
-
As above, until one returns non-blank output (ie, search).
|
50
|
-
If -r is passed, it stops at the first return code of value passed, or 0
|
51
|
-
|
52
|
-
```bash
|
53
|
-
wd -f/--find [ -g/--group group ] [ -r/--return-code ] -- command
|
54
|
-
```
|
55
|
-
|
56
|
-
As above, until one returns blank output. If -r is passed, it stops at the first
|
57
|
-
return code not equal to the value passed, or 0
|
58
|
-
|
59
|
-
```bash
|
60
|
-
wd -a/--all [ -g/--group group ] [ -r/--return-code ] -- command
|
61
|
-
|
62
|
-
```
|
63
|
-
|
64
|
-
The idea here is that you can group several warp points together, and then
|
65
|
-
execute a command in all of them. You could use to:
|
66
|
-
|
67
|
-
* search for a specific file in one of the project repos – you expect to exist in
|
68
|
-
only one of them, and so you want the search to stop once found (indicated
|
69
|
-
by return code equal to 1):
|
70
|
-
|
71
|
-
```bash
|
72
|
-
wd --find --group project-group --return-code=1 -- \
|
73
|
-
find . -name .aws-credentials.lol
|
74
|
-
```
|
75
|
-
|
76
|
-
* you want to run rspec in all projects of the group, and stop at the
|
77
|
-
first non-zero return:
|
78
|
-
|
79
|
-
```bash
|
80
|
-
wd --all --group project-group --return-code -- bundle exec rspec
|
81
|
-
```
|
82
|
-
|
83
|
-
## Networking
|
84
|
-
|
85
|
-
Can we go across SSH?
|
86
|
-
|
87
|
-
```bash
|
88
|
-
wd add proj kig@remote.server.com:~/workspace/proj
|
89
|
-
wd ls proj
|
90
|
-
wd proj
|
91
|
-
```
|
92
|
-
This then establishes and SSH connection to the server and logs you into the shell. Should be pretty easy, I think :)
|
93
|
-
|
94
|
-
## What Else?
|
95
|
-
|
96
|
-
Sky is the limit :) Well, and the black hole that the warp directory is :)
|