From 56a512b7ef3adc0da4a76bd9ce0eedf87eb34959 Mon Sep 17 00:00:00 2001 From: Uriah Date: Tue, 19 Dec 2023 01:19:11 +0800 Subject: [PATCH] ws-cli --- .github/workflows/rust_build.yml | 2 +- Cargo.toml | 6 +++--- README.md | 22 ++++++++++------------ provision.sh | 4 ++-- scripts/postinstall | 7 +++---- src/main.rs | 2 +- 6 files changed, 20 insertions(+), 23 deletions(-) diff --git a/.github/workflows/rust_build.yml b/.github/workflows/rust_build.yml index 4b59f9b..d3e51c5 100644 --- a/.github/workflows/rust_build.yml +++ b/.github/workflows/rust_build.yml @@ -43,7 +43,7 @@ jobs: with: # (required) Comma-separated list of binary names (non-extension portion of filename) to build and upload. # Note that glob pattern is not supported yet. - bin: ws + bin: ws-cli # (optional) Target triple, default is host triple. target: ${{ matrix.target }} # (required) GitHub token for uploading assets to GitHub Releases. diff --git a/Cargo.toml b/Cargo.toml index 699f91e..583a4ae 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,14 +17,14 @@ clap = { version = "4.4.11", features = ["cargo", "derive", "string"] } toml_edit = "0.21.0" [package.metadata.bundle] -name = "ws" # The name of your application -identifier = "com.codeitlikemiley.ws" # The bundle identifier of your application +name = "ws-cli" # The name of your application +identifier = "com.codeitlikemiley.ws-cli" # The bundle identifier of your application copyright = "Copyright (c) codeitlikemiley 2023. All rights reserved." category = "Developer Tool" short_description = "A Workspace CLI for managing GRPC Server Workspace" long_description = "A Workspace CLI for managing GRPC Server Workspace" version = "0.1.0" # Version of your application -osx_url_schemes = ["com.codeitlikemiley.ws"] +osx_url_schemes = ["com.codeitlikemiley.ws-cli"] script = "scripts/postinstall" # Path to your postinstall script [profile.release] diff --git a/README.md b/README.md index b9ffc0f..6625df5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# A CLI tool to Manage GRPC Services Workspace +# A CLI tool (ws-cli) to Manage GRPC Services Workspace [![Release](https://github.com/codeitlikemiley/workspacer/actions/workflows/rust_build.yml/badge.svg)](https://github.com/codeitlikemiley/workspacer/actions/workflows/rust_build.yml) @@ -20,8 +20,6 @@ or Install via Cargo cargo install ws-cli ``` -Note: if you install via cargo , the command you will use is `ws-cli` instead of `ws` - 2. Build it from source @@ -29,8 +27,8 @@ Note: if you install via cargo , the command you will use is `ws-cli` instead of Clone ```sh -git clone htps://github.com/codeitlikemiley/workspacer.git ws -cd ws +git clone htps://github.com/codeitlikemiley/workspacer.git ws-cli +cd ws-cli ``` **For MacOS** @@ -43,8 +41,8 @@ cd ws ```sh cargo build --release -mv ./target/release/ws /usr/local/bin/ws -chmod +x /usr/local/bin/ws +mv ./target/release/ws-cli /usr/local/bin/ws-cli +chmod +x /usr/local/bin/ws-cli ``` **For Windows** @@ -53,7 +51,7 @@ chmod +x /usr/local/bin/ws cargo build --release # Replace 'YourUsername' with your actual username -Move-Item .\target\release\ws.exe C:\Users\YourUsername\bin\ws.exe +Move-Item .\target\release\ws-cli.exe C:\Users\YourUsername\bin\ws-cli.exe # Again, replace 'YourUsername' with your actual username $env:Path += ";C:\Users\YourUsername\bin" @@ -66,7 +64,7 @@ $env:Path += ";C:\Users\YourUsername\bin" ```sh mkdir workspace cd workspace -ws init +ws-cli init ``` 2. Create Server Template @@ -80,7 +78,7 @@ cargo generate --git codeitlikemiley/server_template --name server ```sh mkdir services -ws add auth +ws-cli add auth cd services cargo generate --git codeitlikemiley/services_template --name auth ``` @@ -88,11 +86,11 @@ cargo generate --git codeitlikemiley/services_template --name auth > CLI Example Usage ```sh -ws +ws-cli Manage workspace for GRPC services -Usage: ws +Usage: ws-cli Commands: init Initializes a new workspace diff --git a/provision.sh b/provision.sh index 6ff2457..277d5e1 100755 --- a/provision.sh +++ b/provision.sh @@ -1,7 +1,7 @@ #!/bin/sh cargo clean -rm ws.pkg +rm ws-cli.pkg cargo zigbuild --release cargo bundle --release -pkgbuild --root ./target/release/bundle/osx/ws.app --install-location "/Applications/ws.app" --identifier com.codeitlikemiley.ws --version 0.1.0 --scripts ./scripts ws.pkg +pkgbuild --root ./target/release/bundle/osx/ws-cli.app --install-location "/Applications/ws-cli.app" --identifier com.codeitlikemiley.ws-cli --version 0.1.0 --scripts ./scripts ws-cli.pkg diff --git a/scripts/postinstall b/scripts/postinstall index 4f8bf86..61af9a6 100755 --- a/scripts/postinstall +++ b/scripts/postinstall @@ -8,14 +8,13 @@ USER_HOME=$(eval echo ~$REAL_USER) # Check if the ~/.local/bin directory exists, if not, create it if [ ! -d "$USER_HOME/.local/bin" ]; then - mkdir -p "$USER_HOME/.local/bin" + mkdir -p "$USER_HOME/.local/bin" fi # delete the old symlink if it exists if [ -L "$USER_HOME/.local/bin/ws" ]; then - rm "$USER_HOME/.local/bin/ws" + rm "$USER_HOME/.local/bin/ws" fi - # Create the symlink in ~/.local/bin -ln -s "/Applications/ws.app/Contents/MacOS/ws" "$USER_HOME/.local/bin/ws" +ln -s "/Applications/ws-cli.app/Contents/MacOS/ws-cli" "$USER_HOME/.local/bin/ws" diff --git a/src/main.rs b/src/main.rs index 780cd1d..f11de9e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,7 +4,7 @@ use std::error::Error; use toml_edit::Document; fn main() -> Result<(), Box> { - let matches = Command::new("ws") + let matches = Command::new("ws-cli") .version("0.1.0") .author("Uriah ") .about("Manage workspace for GRPC services")