Skip to content

Commit

Permalink
update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
xztaityozx committed Aug 13, 2018
1 parent 79a9ba2 commit 4843225
Show file tree
Hide file tree
Showing 2 changed files with 181 additions and 1 deletion.
182 changes: 181 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,182 @@
# go-cdx
cdxのgolang版
cdx of Go



## Description

cdx is hyper cd command.



cdx produce useful interface for change directory.

- histories.
- bookmarks.
- custom sources.
- wrapping of popd/pushd



## Require

cdx requires fuzzy-finder tool like fzf.



- [fzf](https://github.com/junegunn/fzf)
- [peco](https://github.com/peco/peco)
- etc



## Install

### 1. Get go-cdx

### go get

```sh
$ go get github.com/xztaityozx/go-cdx
```



### binary download

Please download binary from release page.



### 2. Save basic configuration file

Please save configuration file to `~/.config/go-cdx/.go-cdx.json`

```json
{
"HistoryFile": "~/.config/go-cdx/history.json",
"BookMarkFile":"~/.config/go-cdx/bookmark.json",
"Command":"pushd",
"NoOutput":true,
"Make":false,
"CustomSource":[],
"FuzzyFinder":{
"CommandPath":"fuzzy finder",
"Options":[]
},
"BinaryPath":"/path/to/go-cdx",
}

```



### 3. Load go-cdx

```sh
# activate cdx
$ eval "$(/path/to/go-cdx --init)"
# if you want activate automatically. Please write this command to ~/.zshrc or ~/.bashrc
$ echo 'eval "$(/path/to/go-cdx --init)"' >> ~/.zshrc # or ~/.bashrc
```





## Usage

```sh
go-cdx [--add|-b,--bookmark|--config [file]|
-c,--custom [name]|--help|-h,--history|
--init|--make|--no-output|-p,--popd|
-v,--version] [PATH]
```



### flags

- `--add`
- Add bookmark `$PWD`
- `-b,--bookmark`
- bookmarks
- `--config [file]`
- specify config file
- `-c,--custom [name]`
- custom source. Please read details.
- `--help`
- help for go-cdx
- `-h,--history`
- histories
- `--init`
- output activate command
- `--make`
- if distnation directory could not found. cdx makes directory. This option overwrite config.
- `--no-output`
- disable cdx outputs. This option overwrite config
- `-p,--popd`
- use popd
- `-v,--version`
- output version info.



## Custom Source

You can set custom source for fuzzy finder.



### Example

In this case. cdx from `ghq list`

In `~/.config/go-cdx/.go-cdx.json`

```json
{
...
"CustomSource":[
{
"Name":"g",
"Command":"ghq list | xargs -n1 -I@ echo 'echo -e \"$(basename @) $(ghq root)/@\"'|bash|column -t"
},
],
...
}
```



- `Name`
- subcommand name
- `Command`
- Generate command for fuzzy-finder



And run `cdx --custom g`. cdx will provide fuzzy-finder interface like this.

![](img/cdx_c_g.png)





## Config file

| Name | Description |
| -------------- | ------------------------------------------------------------ |
| `HistoryFile` | /path/to/history.json |
| `BookMarkFile` | /path/to/bookmark.json |
| `Command` | `pushd` or `cd` |
| `NoOutput` | Disable output |
| `Make` | if distnation directory could not found. cdx makes directory |
| `CustomSource` | list of CustomSource |
| `FuzzyFinder` | config for fuzzy-finder |
| `CommandPath` | /path/to/fuzzy-finder |
| `Options` | list of fuzzy-finder's option |



Binary file added img/cdx_c_g.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4843225

Please sign in to comment.