Compile the program:
go build -o sonarCreate a shell function in your .bashrc or .zshrc: You need to set the file path to your binary
sonar() {
local selection_file="/tmp/sonar_selection"
# Run interactively TUI
<file_path>/sonar "$@"
exit_code=$?
# Check if selection was made
if [[ -f "$selection_file" && "$exit_code" -eq 0 ]]; then
target_dir="$(cat "$selection_file")"
rm -f "$selection_file"
if [[ -n "$target_dir" ]]; then
cd "$target_dir" || echo "Failed to cd into $target_dir"
fi
fi
}
Source your shell configuration:
source ~/.bashrc # or ~/.zshrcNow you can run:
sonar