Skip to content

Commit

Permalink
chore: rename "ttg" to "travelgrunt" YOLO
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanilves committed Oct 22, 2022
1 parent 2891b22 commit 4579d6a
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 27 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
vendor/

# Compiled binaries and assets
/cmd/ttg/*
!/cmd/ttg/*.go
/cmd/travelgrunt/*
!/cmd/travelgrunt/*.go
/release/*
!/release/.gitkeep
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
APP_NAME := ttg
GITHUB_REPO := ivanilves/ttg
APP_NAME := travelgrunt
GITHUB_REPO := ivanilves/travelgrunt
API_VERSION := 0.1

APP_VERSION := $(shell (git fetch --tags && git tag --sort=creatordate | grep -F "v${API_VERSION}." || echo UNDEFINED) | tail -n1)
Expand All @@ -26,7 +26,7 @@ clean:

install: PREFIX := /usr/local
install:
install ${BUILD_PATH}/ttg ${PREFIX}/bin/
install ${BUILD_PATH}/travelgrunt ${PREFIX}/bin/

changelog: LAST_RELEASED_TAG:=$(shell git tag --sort=creatordate | tail -n1)
changelog: GITHUB_COMMIT_URL:=https://github.com/${GITHUB_REPO}/commit
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
# ttg
# travelgrunt

**T**ravel **T**erra**g**runt directory tree as a first class passenger! :sunglasses:

## How to use?

* `cd` to the directory of your [locally cloned] Terragrunt/Terraform Git repo;
* run `ttg` command there :rocket: ([optional] arguments are "path filter" matches);
* run `travelgrunt` command there :rocket: ([optional] arguments are "path filter" matches);
* use arrow keys to navigate the list and `/` key to search for specific projects;

## Shell aliases

It is **highly** recommended to use `bash` (or `zsh`) aliases. Start from something like this:
```
alias ttg='_ttg(){ ttg -outFile ~/.ttg-path ${@} && cd "$(cat ~/.ttg-path)" }; _ttg'
alias ttt='ttg --top'
alias tg='_tg(){ travelgrunt --out-file ~/.travelgrunt-path ${@} && cd "$(cat ~/.travelgrunt-path)" }; _tg'
alias tt='travelgrunt --top --out-file ~/.travelgrunt-path ${@} && cd "$(cat ~/.travelgrunt-path)"'
```

:bulb: `ttg --top` is a "shortcut" that brings you to the top level path of your repository.
:bulb: `travelgrunt --top` is a "shortcut" that brings you to the top level path of your repository.

### Why aliases?
Core aspect of this program is the ability to change working directory while staying **inside the current shell**.
This can not be done by the program itself, because of obvious security related `POSIX` limitations. Without instrumenting
the shell with aliases `ttg` still can kinda work, but will provide you with much more awkward and second class user
the shell with aliases `travelgrunt` still can kinda work, but will provide you with much more awkward and second class user
experience, i.e. you will need to exit subshell before you "jump" to the next project. :weary:

## How to build?

* `make dep` - install dependencies;
* `make build` - build the `ttg` binary in `cmd/ttg` path;
* `make install` - [optional] install built `ttg` binary under the `${PREFIX}/bin` location;
* `make build` - build the `travelgrunt` binary in `cmd/travelgrunt` path;
* `make install` - [optional] install built `travelgrunt` binary under the `${PREFIX}/bin` location;

## How to release a new version?

Expand Down
18 changes: 9 additions & 9 deletions cmd/ttg/main.go → cmd/travelgrunt/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import (
"log"
"os"

"github.com/ivanilves/ttg/pkg/directory"
"github.com/ivanilves/ttg/pkg/directory/tree"
"github.com/ivanilves/ttg/pkg/file"
"github.com/ivanilves/ttg/pkg/filter"
"github.com/ivanilves/ttg/pkg/menu"
"github.com/ivanilves/ttg/pkg/scm"
"github.com/ivanilves/ttg/pkg/shell"
"github.com/ivanilves/ttg/pkg/terminal"
"github.com/ivanilves/travelgrunt/pkg/directory"
"github.com/ivanilves/travelgrunt/pkg/directory/tree"
"github.com/ivanilves/travelgrunt/pkg/file"
"github.com/ivanilves/travelgrunt/pkg/filter"
"github.com/ivanilves/travelgrunt/pkg/menu"
"github.com/ivanilves/travelgrunt/pkg/scm"
"github.com/ivanilves/travelgrunt/pkg/shell"
"github.com/ivanilves/travelgrunt/pkg/terminal"
)

var appVersion = "default"
Expand All @@ -22,7 +22,7 @@ var top bool
var version bool

func init() {
flag.StringVar(&outFile, "outFile", "", "output project path into the file specified instead of spawning a shell")
flag.StringVar(&outFile, "out-file", "", "output project path into the file specified instead of spawning a shell")
flag.BoolVar(&top, "top", false, "get to the repository top level (root) path and exit")
flag.BoolVar(&version, "version", false, "print application version and exit")
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/ivanilves/ttg
module github.com/ivanilves/travelgrunt

go 1.18

Expand Down
2 changes: 1 addition & 1 deletion pkg/directory/tree/tree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/stretchr/testify/assert"

"github.com/ivanilves/ttg/pkg/directory"
"github.com/ivanilves/travelgrunt/pkg/directory"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion pkg/scm/scm.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package scm
import (
"fmt"

"github.com/ivanilves/ttg/pkg/scm/git"
"github.com/ivanilves/travelgrunt/pkg/scm/git"
)

func detectSCM() string {
Expand Down
4 changes: 2 additions & 2 deletions pkg/shell/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ func Name() string {
return os.Args[0]
}

// IsRunningInside tells us if we try to run inside a shell spawned by ttg
// IsRunningInside tells us if we try to run inside a shell spawned by travelgrunt
func IsRunningInside() bool {
return os.Getenv("TTG") == "true"
}

// Getppid returns numerical process ID of the parent ttg process
// Getppid returns numerical process ID of the parent travelgrunt process
func Getppid() int {
ppid, _ := strconv.Atoi(os.Getenv("TTG_PID"))

Expand Down

0 comments on commit 4579d6a

Please sign in to comment.