diff --git a/README.md b/README.md index e741d46..c9acb05 100644 --- a/README.md +++ b/README.md @@ -30,35 +30,55 @@ docker run -it --name mynav --rm ubuntu bash -c ' ' ``` -### Build from source -> ->Note: Requires go to be installed +### Binary installation ```bash -curl -fsSL https://raw.githubusercontent.com/GianlucaP106/mynav/main/install.sh | bash +curl -fsSL https://raw.githubusercontent.com/GianlucaP106/mynav/main/install.bash | bash ``` -### Add to PATH +> **See all binaries on the [latest release](https://github.com/GianlucaP106/mynav/releases/latest) page.** + +### Build from source ```bash +# go to mynav's configuration directory +mkdir ~/.mynav/ 2>/dev/null | true +cd ~/.mynav + +# clone the repo +git clone https://github.com/GianlucaP106/mynav src +cd src + +# build the project +go build -o ~/.mynav/mynav + +# add to path export PATH="$PATH:$HOME/.mynav" + +# optionally delete the source code +cd ~/.mynav +rm -rf src ``` +#### Supported platforms + +mynav is only supported for Linux and MacOS. + ## Usage ```bash mynav ``` ->Note: -> -> - mynav will look for a configuration in the current or any parent directory, otherwise will ask to initialize the current directory. -> - mynav can be initialized in multiple independant directories, but not nested. -> - mynav cannot be initialized in the user home directory. +#### Configuration + +- mynav will look for a configuration in the current or any parent directory, otherwise will ask to initialize the current directory. +- mynav can be initialized in multiple independant directories, but not nested. +- mynav cannot be initialized in the user home directory. ## Features -### Workspace and session management +#### Workspace and session management - Organize workspaces by topic. - Create, view, update and delete workspaces and topics. @@ -66,14 +86,14 @@ mynav - Enter a session for each workspace, allowing to swap between workspaces easilty (uses tmux). - Create, view, update and delete workspace sessions. -### Tmux session, windows and panes +#### Tmux session, windows and panes - View tmux session, windows and panes. - Create, view. update and delete tmux sessions. - View a preview of tmux sessions. - A number of tmux commands as keymaps. -### Simple development oriented Github client +#### Simple Github client - Authenticate using device authentication or personal access token authentication. - View github profile info, repos and PRs. @@ -81,8 +101,8 @@ mynav - Clone repo directly to a workspace, avoiding the need to use your browser. ## Keymaps -> -> ### Use '?' in the TUI to see all the key maps + +#### Use '?' in the TUI to see all the key maps #### Global diff --git a/install.bash b/install.bash new file mode 100755 index 0000000..694a1fa --- /dev/null +++ b/install.bash @@ -0,0 +1,47 @@ +#! /bin/bash + +echo "Installing mynav..." + +echo "Initializing configuration directory at ~/.mynav" +mkdir ~/.mynav/ 2>/dev/null | true +cd ~/.mynav + +latest_release=$(curl -sL "https://api.github.com/repos/GianlucaP106/mynav/releases/latest") +latest_tag=$(echo "$latest_release" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') + +echo "Installing latest release ${latest_tag}" + +os="$(uname -s)" +arch="$(uname -m)" + +echo "Detected platform ${os}-${arch}" + +file="mynav_${os}_${arch}.tar.gz" + +curl -s -L -o build.tar.gz https://github.com/GianlucaP106/mynav/releases/download/${latest_tag}/${file} + +tar -xzf build.tar.gz 2>/dev/null +if [ $? -ne 0 ]; then + echo "Failed to install mynav. Platform not supported." + exit +fi + +rm build.tar.gz + +directory="$HOME/.mynav" +if echo "$PATH" | grep -q "$directory"; then + echo "Successfully installed mynav at ~/.mynav!" +else + echo "Adding ~/.mynav to PATH" + rc_files=(~/.bashrc ~/.zshrc ~/.profile ~/.bash_profile ~/.bash_login ~/.cshrc ~/.tcshrc) + for file in "${rc_files[@]}"; do + if [ -f "$file" ]; then + echo "Adding to $file" + echo '# mynav path export' >>"$file" + echo 'export PATH="$PATH:$HOME/.mynav"' >>"$file" + break + fi + done + echo "Successfully installed mynav at ~/.mynav!" + echo "Restart your terminal session." +fi diff --git a/install.sh b/install.sh deleted file mode 100644 index 91a5892..0000000 --- a/install.sh +++ /dev/null @@ -1,22 +0,0 @@ -#! /bin/bash - -mkdir ~/.mynav/ 2>/dev/null | true -cd ~/.mynav - -rm -rf src - -latest_release=$(curl -sL "https://api.github.com/repos/GianlucaP106/mynav/releases/latest") -latest_tag=$(echo "$latest_release" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') - -curl -fsSL https://github.com/GianlucaP106/mynav/archive/refs/tags/${latest_tag}.zip -o src.zip - -unzip -d src "src.zip" -rm -rf "src.zip" - -tag_without_v=$(echo "$latest_tag" | tr -d "v") -cd "src/mynav-${tag_without_v}" -go build -o mynav -mv mynav ../../mynav - -cd ~/.mynav -rm -rf src