diff --git a/README.md b/README.md index 75c9124..6e78115 100755 --- a/README.md +++ b/README.md @@ -165,13 +165,14 @@ If your current working directory is within an initialised git repository, there ### Options -- `-d, --dir`: Specify the path to the mounted volume directory. Default is `/SharedRepos`. The path is relative to the root of the mounted volume. -- `-e, --exclude`: Comma-separated list of paths to exclude from syncing. Paths should be relative to the repository root. Default exclusions include: `node_modules/`, `.git/`, `bin/`, `obj/`. -- `-f, --force`: Initiates the sync immediately, foregoing the formatted change summary. This option is a faster alternative to `-y`/`--yes`, which requires a dry run to produce the change summary. -- `-h, --help`: Display the help message and exit. -- `-t, --type`: Specify the type of mounted volume: 'networked' or 'removable' (e.g., a USB stick). Default is 'networked'. -- `-V, --volume`: Specify the name of the mounted volume. Default is '`z`'. Ensure the volume is mounted and writable at the following locations: For macOS, under `/Volumes`. For Linux, use `/mnt` for networked volumes and `/media` for removable volumes. -- `-y, --yes`: This option bypasses user confirmation by auto-responding 'yes' to the sync confirmation prompt. However, it still produces the formatted change summary for review after the sync. If `-f`/`--force` is also specified, this option is disregarded. +- **`-d, --dir`**: Specify the path to the mounted volume directory. Default is `/SharedRepos`. The path is relative to the root of the mounted volume. +- **`-e, --exclude`**: Comma-separated list of paths to exclude from syncing. Paths should be relative to the repository root. Default exclusions include: `node_modules/`, `.git/`, `bin/`, `obj/`. +- **`-f, --force`**: Initiates the sync immediately, foregoing the formatted change summary. This option is a faster alternative to `-y`/`--yes`, which requires a dry run to produce the change summary. +- **`-h, --help`**: Display the help message and exit. +- **`-t, --type`**: Specify the type of mounted volume: 'networked' or 'removable' (e.g., a USB stick). Default is 'networked'. +- **`-v, --version`**: Display the current version of `glit` and exit. +- **`-V, --volume`**: Specify the name of the mounted volume. Default is '`z`'. Ensure the volume is mounted and writable at the following locations: For macOS, under `/Volumes`. For Linux, use `/mnt` for networked volumes and `/media` for removable volumes. +- **`-y, --yes`**: This option bypasses user confirmation by auto-responding 'yes' to the sync confirmation prompt. However, it still produces the formatted change summary for review after the sync. If `-f`/`--force` is also specified, this option is disregarded. ## Examples diff --git a/main.sh b/main.sh index 83eb0de..ae85d4c 100755 --- a/main.sh +++ b/main.sh @@ -38,7 +38,7 @@ source "$DIR/modules/utils.sh" source "$DIR/modules/sync_fns.sh" source "$DIR/modules/loading_spinner.sh" -# --- Usage Fn --- +# --- Display Info Fns --- display_help() { echo "" @@ -65,6 +65,8 @@ display_help() { echo " -t, --type Specify the type of mounted volume: 'networked' or 'removable'." echo " Default is 'networked'." echo "" + echo " -v, --version Display version information and exit." + echo "" echo " -V, --volume Specify the name of the mounted volume. Default is '$DEFAULT_VOLUME_NAME'." echo " Ensure the volume is mounted and writable at the following" echo " locations: For macOS, under \`/Volumes\`. For Linux, use \`/mnt\`" @@ -81,6 +83,24 @@ display_help() { exit 0 } +display_version() { + echo "" + echo -e "\e[1m\`glit\` $VERSION\e[0m" + echo "" + echo "Release Date: $RELEASE_DATE" + echo "" + echo "License: MIT" + echo -e "Website: \e]8;;https://github.com/justJackjon/glit\ahttps://github.com/justJackjon/glit\e]8;;\a" + echo -e "Contact: \e]8;;https://github.com/justJackjon/glit/issues\ahttps://github.com/justJackjon/glit/issues\e]8;;\a" + echo "" + echo "About:" + echo "\`glit\` is a user-friendly wrapper around \`rsync\`, designed to assist in synchronising" + echo "git repositories with mounted volumes such as networked drives or removable media." + echo "" + + exit 0 +} + # --- Main Logic --- parse_config diff --git a/modules/arg_parsing.sh b/modules/arg_parsing.sh index 81772ad..26ca9e2 100755 --- a/modules/arg_parsing.sh +++ b/modules/arg_parsing.sh @@ -120,6 +120,11 @@ parse_options() { shift $TWO_VALUES_CONSUMED ;; + -v|--version) + display_version + + # NOTE: display_version will exit, so we don't need to do anything else here. + ;; -V|--volume) check_opt_missing_value "$current_value" "$next_value" diff --git a/modules/variables.sh b/modules/variables.sh index 9d95081..06911e1 100755 --- a/modules/variables.sh +++ b/modules/variables.sh @@ -1,3 +1,5 @@ +VERSION="v0.0.1-alpha" +RELEASE_DATE="October 10, 2023" FORCE_ACTION=0 AUTO_CONFIRM=0 DEFAULT_VOLUME_NAME="z"