Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 122 lines (79 sloc) 4.407 kb
75f6ae6 @chendo Added a README
authored
1 # filepath
2 ### `which` for open files
3
4 Do you drag file handles from app titlebars into your terminal a lot?
5 And you consider yourself a hardened keyboard warrior and don't like
6 using the mouse unless absolutely necessary?
7
8 ## Without `filepath`
9
7ad186d @chendo Removed some warnings and now using getopt_long to parse options
authored
10 (These following screenshots are out of date and reflect v0.2)
11
75f6ae6 @chendo Added a README
authored
12 ![Without filepath](https://img.skitch.com/20110421-x5476hjstjuf74wpyg83h763a2.png Without filepath)
13
14 Sure, you might say "I'd just type and tab complete that shit." But let's
15 just imagine that file is really deep in the project hierarchy
16 or just really damn annoying to autocomplete because there's a billion
a552f47 @chendo Tweaked README
authored
17 files with the same prefixes.
75f6ae6 @chendo Added a README
authored
18
19 Now, let's take a look at your coding life with `filepath`.
20
21 ## With `filepath`
22
23 ![With filepath](https://img.skitch.com/20110421-q1msk7rux2xcjbdm2r5uq6j1i.png With filepath)
24
25 "Holy shit, that's amazing!" you say, "But what about if I have more
26 than one window? Which one does it choose?"
27
28 ![Choices](https://img.skitch.com/20110421-k1ud63xtwprwgi8c7pjsb1wgsb.png choices)
29
30 You get a choice! `filepath` is democratic like that.
31
32 ## Want it?
33
0ac9fb2 @chendo Added a changelog to the README
authored
34 You can grab it from the [downloads page](https://github.com/chendo/filepath/downloads)
35 or build it yourself, then slap it in any directory in your $PATH (I
36 suggest `/usr/local/bin`).
37
38 I'll probably write a recipe for homebrew at some point.
75f6ae6 @chendo Added a README
authored
39
4ddec11 @chendo Added option to default to the first choice for Ben
authored
40 This requires Snow Leopard (10.6) and access for assistive devices must
41 be enabled in Accessibility.
42
43 This only works on applications that use NSDocument. Let me know if it
44 doesn't work for an application with a draggable handle in the title bar.
45
46 If you somehow don't have Snow Leopard, upgrade already.
47
7ad186d @chendo Removed some warnings and now using getopt_long to parse options
authored
48 ## Basic Usage (which there's not much point to)
49
50 $ filepath # Gets the path from the most recently used window
51 # that has a document
52 /Users/chendo/foo.txt
53
54 $ filepath textmate # Gets documents from Textmate
55 /Users/chendo/opened_in_textmate.txt
56
57 $ filepath --verbose
58 Getting path from MacVim...
59 /Users/chendo/foo.txt
4ddec11 @chendo Added option to default to the first choice for Ben
authored
60
7ad186d @chendo Removed some warnings and now using getopt_long to parse options
authored
61 $ filepath --choose # Gives you the option to pick which file to
62 # output to stdout
63 Multiple paths found:
64 1: /Users/chendo/foo.txt
65 2: /Users/chendo/bar.txt
66 Enter choice: 2
67 /Users/chendo/bar.txt
75f6ae6 @chendo Added a README
authored
68
7ad186d @chendo Removed some warnings and now using getopt_long to parse options
authored
69 ## Intended Usage
a552f47 @chendo Tweaked README
authored
70
7ad186d @chendo Removed some warnings and now using getopt_long to parse options
authored
71 $ alias fp=filepath # For the lazy
72 $ cucumber `fp`
73 $ spec `fp`
74 $ git add `fp`
75
76 And so on and so forth. If you use `zsh`, then you can do:
77
78 $ cucumber `fp`<TAB> # And zsh will replace `fp` with the actual path and becomes:
79 $ cucumber /Users/chendo/awesome.feature
a552f47 @chendo Tweaked README
authored
80
75f6ae6 @chendo Added a README
authored
81 ## Why?
82
83 I like being efficient. I'd rather spend an hour or two writing a tool
84 making me more efficient in the long run than waste two seconds every
85 time I drag a file into the terminal.
86
0ac9fb2 @chendo Added a changelog to the README
authored
87
88 ## Changelog
89
7ad186d @chendo Removed some warnings and now using getopt_long to parse options
authored
90 * v0.3
91 * Now using getopt_long for option parsing goodness
92 * Silenced the output by default to make it more zsh backtick
93 subsitution-friendly.
94 * Added --verbose
95 * Picks the first file by default unless --choose is selected
96 * Added Usage and help
97
4ddec11 @chendo Added option to default to the first choice for Ben
authored
98 * v0.2
99 * Added -f option.
0ac9fb2 @chendo Added a changelog to the README
authored
100
4ddec11 @chendo Added option to default to the first choice for Ben
authored
101 * v0.1
102 * First release.
0ac9fb2 @chendo Added a changelog to the README
authored
103
75f6ae6 @chendo Added a README
authored
104 ## Contribute
105
106 Fork and send me pull requests! You might be able to tell that I don't
107 code Objective-C/C very often and so I'm happy to learn better ways of
108 doing things.
109
110 ## License
111
112 (The MIT License)
113
114 Copyright © 2011 Jack "chendo" Chen
115
116 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
117
118 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
119
120 THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
121
Something went wrong with that request. Please try again.