Skip to content

Commit

Permalink
Merge pull request #1 from codeitlikemiley/ws-cli
Browse files Browse the repository at this point in the history
ws-cli
  • Loading branch information
codeitlikemiley authored Dec 18, 2023
2 parents 5389f85 + 56a512b commit c10e06a
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
22 changes: 10 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)

Expand All @@ -20,17 +20,15 @@ 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


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**
Expand All @@ -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**
Expand All @@ -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"
Expand All @@ -66,7 +64,7 @@ $env:Path += ";C:\Users\YourUsername\bin"
```sh
mkdir workspace
cd workspace
ws init
ws-cli init
```

2. Create Server Template
Expand All @@ -80,19 +78,19 @@ 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
```

> CLI Example Usage
```sh
ws
ws-cli

Manage workspace for GRPC services

Usage: ws <COMMAND>
Usage: ws-cli <COMMAND>

Commands:
init Initializes a new workspace
Expand Down
4 changes: 2 additions & 2 deletions provision.sh
Original file line number Diff line number Diff line change
@@ -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
7 changes: 3 additions & 4 deletions scripts/postinstall
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::error::Error;
use toml_edit::Document;

fn main() -> Result<(), Box<dyn Error>> {
let matches = Command::new("ws")
let matches = Command::new("ws-cli")
.version("0.1.0")
.author("Uriah <[email protected]>")
.about("Manage workspace for GRPC services")
Expand Down

0 comments on commit c10e06a

Please sign in to comment.