日本語はこっち (Let's try reading in Japanese.)
cdand
is a simple CLI command.
It can launch every commands(e.g. git
, yarn
) in your target directory without cd
.
It's written in Go, so it will work on many operating systems.
There are many commands that expect you already changed the current directory before launch.
For example, pwd
.
$ pwd
/media/removable/SD Card/current
$ pwd subdir/subsubdir
/media/removable/SD Card/current
By using cdand
, you can type simply.
$ cdand subdir/subsubdir pwd
/media/removable/SD Card/current/subdir/subsubdir
If you don't use cdand
, there is no way to get expected results without changing the current directory.
And one more command will be required to restore the current directory.
$ cd subdir/subsubdir; pwd
$ cd ../..
By adding cdand
to PATH, you can say good-bye to cd ../..
.
-
Operating System
- Windows
- macOS
- Linux
-
Windows: cdand_win.zip
-
macOS: cdand_mac.dmg
-
Linux (
chmod u+x cdand
required)- x64: cdand_linux_amd64.tar.gz
- ARM: cdand_linux_arm64.tar.gz
- Raspberry Pi: cdand_linux_armv7l.tar.gz
$ go get github.com/kako-jun/cdand
$ cdand subdir/subsubdir ls -alF
drwxrwxr-x. 2 kako-jun kako-jun 4096 Apr 2 04:20 ./
drwxr-xr-x. 10 kako-jun kako-jun 4096 Apr 2 04:20 ../
-rw-rw-r--. 1 kako-jun kako-jun 0 Apr 2 04:20 my_secrets.txt
"Why is cdand
useful?" Here are the examples.
$ cdand your/git/repository git status
$ cdand your/node/project yarn
The point is, you don't need to care the difference between options of each command.
e.g.
-C
option ofgit
-prefix
,-cwd
options ofnode
They are hard to remember, aren't they?
How is the following?
$ (cd subdir/subsubdir; ls)
It's a cool way for who likes typing many brackets.
After you typed cd
, if you saw a troublesome future, let's append and
.
After that, use TAB key to autocomplete the target directory name.
$ cdand ../sister_project npm install
It's also helpful to keep indoors(subdirectory).
cdand
can be called recursively.
$ cdand subdir cdand .. cdand subdir cdand .. ls
Ummmm...are there any merits? (Probably nothing.)
e.g. ls -G
vim
can launch, but not shown in terminal.less
can launch, but cannnot paging.- The stdout from interactive command is shown at the same time.
For example, in case you type as below
$ cdand subdir cat my_secrets.txt | grep treasure
At first,
$ cdand subdir cat my_secrets.txt
runs.
Next,
$ grep treasure
runs for the first result.
In pipe case, the above order may not be a problem.
But in redirect case, a problem occurs.
$ cdand subdir cat my_secrets.txt > my_will.txt
my_will.txt
isn't created in subdir
but in the current directory.
If you want to get it in subdir
, you have to create a script as below.
cat my_secrets.txt > my_will.txt
And put the above script in subdir
.
Lastly,
$ cdand subdir foo.sh
But it probably has no benefit... 😭
import "github.com/kako-jun/cdand/cdand-core"
cdand.Exec("subdir/subsubdir", "ls", "-alF")
I'm always looking for new contributing.
- Adding features
- Overwriting with better code
- Finding (and fixing) bugs
- Improving translation
kako-jun
- https://github.com/kako-jun
- 📓 https://gist.github.com/kako-jun
- 🏠 https://llll-ll.com
- 🐦 https://twitter.com/kako_jun_42
Your donation turns into my cat's food.
Please open the following link, and enter kako.hydrajin@gmail.com
into 'To' box.
- Tell me your impressions in 'Message' box.
- The sender is hidden.
- From $1
This project is licensed under the MIT License.
See the LICENSE file for details.
- Go
- and you