Skip to content

Commit

Permalink
Merge pull request #51 from ivanilves/CTRL-D
Browse files Browse the repository at this point in the history
feat: regulate and split CTRL+C/CTRL+D behavior
  • Loading branch information
ivanilves committed Aug 7, 2023
2 parents bebcf4d + 3e1b5f6 commit c85ce10
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ Core feature of this program is the ability to change working directory while st
This **can not** be done by the program itself, because of `POSIX` security limitations. Without instrumenting
the shell with aliases `travelgrunt` will not work!

### `CTRL+C` / `CTRL+D` behaviour
When key combinations `CTRL+C` or `CTRL+D` get pressed during the execution, following occures:
* `CTRL+C` - program terminates with exit code `1`, under the starting directory path;
* `CTRL+D` - program terminates with exit code `0`, under the directory path currently selected;

## How to install? :neckbeard:

### Install with `homebrew`:
Expand Down
4 changes: 4 additions & 0 deletions cmd/travelgrunt/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ func buildMenuFromTree(t tree.Tree) string {

if err != nil {
if err.Error() == "^C" {
os.Exit(1)
}

if err.Error() == "^D" {
return parentID
}

Expand Down

0 comments on commit c85ce10

Please sign in to comment.