Live data from Hacker News

Show HN: Unix tool that visualizes shell commands usage

github.com

21–25 of 25 posts

Re: Show HN: Unix tool that visualizes shell commands usage

#21
post #9

Looks cool, but nothing much happens for me. I used brew to install go, then ran the following: % type -a go /usr/local/bin/go % cd tsukae % go get -d ./... go: downloading github.com/inconshreveable/mousetrap v1.0.0 % go run main.go o: downloading github.com/spf13/cobra v1.1.3 go: downloading github.com/gizak/termui/v3 v3.1.0 go: downloading github.com/mattn/go-runewidth v0.0.2 go: downloading github.com/nsf/termbox…

cd tsukae go build ./tsukae

Closer! That got me the executable. Now I get a stack trace....

  % ./tsukae bash
  panic: runtime error: slice bounds out of range [:7] with capacity 4

  goroutine 1 [running]:
    github.com/irevenko/tsukae/cmd.GetShellCommandsUsage(0x1205b84, 0x4, 0x7, 0x4, 0x3, 0xc000066180, 0xc000127d78, 0x1159965, 0xc000120500)
   /Users/pww/tsukae/cmd/shell_name.go:22 +0x16d
  github.com/irevenko/tsukae/cmd.glob..func4(0x135df20, 0xc00005c8b0, 0x0, 0x1)
   /Users/pww/tsukae/cmd/commands.go:88 +0x1bf
  github.com/spf13/cobra.(*Command).execute(0x135df20, 0xc00005c8a0, 0x1, 0x1, 0x135df20, 0xc00005c8a0)
    /Users/pww/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:856 +0x2c2
  github.com/spf13/cobra.(*Command).ExecuteC(0x135e1a0, 0xc000000180, 0xc000127f78, 0x10069e5)
     /Users/pww/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:960 +0x375
  github.com/spf13/cobra.(\*Command).Execute(...)
       /Users/pww/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:897
  main.main()
   /Users/pww/tsukae/main.go:12 +0x36

Re: Show HN: Unix tool that visualizes shell commands usage

#22

Earlier quoted context omitted.

Going to my home dir is another frequent operation for me so I also have alias ~='pushd ~' (Those are tildes but may look like dashes depending on your font and size...) Not as fancy as some other aliases I see here but does the (basic) trick.

A raw "cd" with no arguments will take you back to your home-directory. Of course "~" is one less character to type, but on the off-chance you didn't know.

As we're offering alternatives. Either `shopt autocd` in bash or `setopt auto_cd` in zsh, then ~ changes to home by simply being a path.

Re: Show HN: Unix tool that visualizes shell commands usage

#24
post #9

Earlier quoted context omitted.

cd tsukae go build ./tsukae

Closer! That got me the executable. Now I get a stack trace.... % ./tsukae bash panic: runtime error: slice bounds out of range [:7] with capacity 4 goroutine 1 [running]: github.com/irevenko/tsukae/cmd.GetShellCommandsUsage(0x1205b84, 0x4, 0x7, 0x4, 0x3, 0xc000066180, 0xc000127d78, 0x1159965, 0xc000120500) /Users/pww/tsukae/cmd/shell_name.go:22 +0x16d github.com/irevenko/tsukae/cmd.glob..func4(0x135df20, 0xc00005c8b…

i figured it out, you just need to have bigger history, currently you only have 4 unique commands in your hist file.

Re: Show HN: Unix tool that visualizes shell commands usage

#25

Earlier quoted context omitted.

Closer! That got me the executable. Now I get a stack trace.... % ./tsukae bash panic: runtime error: slice bounds out of range [:7] with capacity 4 goroutine 1 [running]: github.com/irevenko/tsukae/cmd.GetShellCommandsUsage(0x1205b84, 0x4, 0x7, 0x4, 0x3, 0xc000066180, 0xc000127d78, 0x1159965, 0xc000120500) /Users/pww/tsukae/cmd/shell_name.go:22 +0x16d github.com/irevenko/tsukae/cmd.glob..func4(0x135df20, 0xc00005c8b…

i figured it out, you just need to have bigger history, currently you only have 4 unique commands in your hist file.

My history has a few thousand commands....
Post reply on HN