Skip to content

Commit

Permalink
refactor: rename clash to mihomo
Browse files Browse the repository at this point in the history
  • Loading branch information
spencerwooo committed Dec 29, 2023
1 parent 5797bee commit 6eeb911
Show file tree
Hide file tree
Showing 7 changed files with 187 additions and 183 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,27 @@ jobs:
matrix:
include:
- target: x86_64-unknown-linux-gnu
name: clashrup-x86_64-unknown-linux-gnu.tar.gz
name: mihoro-x86_64-unknown-linux-gnu.tar.gz
cross: false
strip: true
- target: x86_64-unknown-linux-musl
name: clashrup-x86_64-unknown-linux-musl.tar.gz
name: mihoro-x86_64-unknown-linux-musl.tar.gz
cross: true
strip: true
- target: i686-unknown-linux-gnu
name: clashrup-i686-unknown-linux-gnu.tar.gz
name: mihoro-i686-unknown-linux-gnu.tar.gz
cross: true
strip: true
- target: i686-unknown-linux-musl
name: clashrup-i686-unknown-linux-musl.tar.gz
name: mihoro-i686-unknown-linux-musl.tar.gz
cross: true
strip: true
- target: aarch64-unknown-linux-gnu
name: clashrup-aarch64-unknown-linux-gnu.tar.gz
name: mihoro-aarch64-unknown-linux-gnu.tar.gz
cross: true
strip: false
- target: aarch64-unknown-linux-musl
name: clashrup-aarch64-unknown-linux-musl.tar.gz
name: mihoro-aarch64-unknown-linux-musl.tar.gz
cross: true
strip: false

Expand All @@ -53,13 +53,13 @@ jobs:
use-cross: ${{ matrix.cross }}

- name: Strip binaries
run: strip target/${{ matrix.target }}/release/clashrup
run: strip target/${{ matrix.target }}/release/mihoro
if: ${{ matrix.strip }}

- name: Package binaries
run: |
cd target/${{ matrix.target }}/release
tar -czvf ${{ matrix.name }} clashrup
tar -czvf ${{ matrix.name }} mihoro
cd -
- name: Upload binaries to release
Expand Down
22 changes: 11 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@ edition = "2021"
readme = "README.md"
license = "MIT"
authors = ["spencerwooo <[email protected]>"]
homepage = "https://github.com/spencerwooo/clashrup"
repository = "https://github.com/spencerwooo/clashrup"
homepage = "https://github.com/spencerwooo/mihoro"
repository = "https://github.com/spencerwooo/mihoro"
keywords = ["cli", "clash", "network", "linux"]
categories = ["command-line-utilities"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
clap = { version = "4.4.11", features = ["derive"] }
clap_complete = "4.4.4"
colored = "2.0.4"
serde = { version = "1.0.193", features = ["derive"] }
toml = "0.7.3"
clap = { version = "4.4", features = ["derive"] }
clap_complete = "4.4"
colored = "2.0"
serde = { version = "1.0", features = ["derive"] }
toml = "0.8"
flate2 = "1.0"
shellexpand = "3.1.0"
shellexpand = "3.1"
openssl = { version = "0.10", features = ["vendored"] }
serde_yaml = "0.9.19"
local-ip-address = "0.5.1"
serde_yaml = "0.9"
local-ip-address = "0.5"
reqwest = { version = "0.11", features = ["stream"] }
futures-util = "0.3"
indicatif = "0.17"
tokio = { version = "1.34", features = ["full"] }
truncatable = "0.1.3"
truncatable = "0.1"
20 changes: 10 additions & 10 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
# shellcheck shell=dash

# Installing clashrup - with code shamelessly referenced from zoxide/install.sh
# Installing mihoro - with code shamelessly referenced from zoxide/install.sh
#
# https://github.com/ajeetdsouza/zoxide/blob/7af4da1dabfcfc9a4b23cc8807150bf2f61a0df6/install.sh
#
Expand Down Expand Up @@ -30,7 +30,7 @@ main() {
cd "$_tmp_dir" || err "cd: failed to enter directory: $_tmp_dir"

# Download and extract zoxide.
ensure download_clashrup "$_arch"
ensure download_mihoro "$_arch"
local _package="$RETVAL"
assert_nz "$_package" "package"
echo "Downloaded package: $_package"
Expand All @@ -51,20 +51,20 @@ main() {
# Install binary.
local _bin_dir="$HOME/.local/bin"
local _bin_name
_bin_name="clashrup"
_bin_name="mihoro"
ensure mkdir -p "$_bin_dir"
ensure cp "$_bin_name" "$_bin_dir"
echo "Installed clashrup to $_bin_dir"
echo "Installed mihoro to $_bin_dir"

# Print success message and check $PATH.
echo ""
echo "clashrup is installed!"
echo "mihoro is installed!"
if ! echo ":$PATH:" | grep -Fq ":$_bin_dir:"; then
echo "NOTE: $_bin_dir is not on your \$PATH. clashrup will not work unless it is added to \$PATH."
echo "NOTE: $_bin_dir is not on your \$PATH. mihoro will not work unless it is added to \$PATH."
fi
}

download_clashrup() {
download_mihoro() {
local _arch="$1"

if check_cmd curl; then
Expand All @@ -76,7 +76,7 @@ download_clashrup() {
fi
need_cmd grep

local _releases_url="https://api.github.com/repos/spencerwooo/clashrup/releases/latest"
local _releases_url="https://api.github.com/repos/spencerwooo/mihoro/releases/latest"
local _releases
case "$_dld" in
curl) _releases="$(curl -sL "$_releases_url")" ||
Expand All @@ -87,7 +87,7 @@ download_clashrup() {

local _package_url
_package_url="$(echo "$_releases" | grep "browser_download_url" | cut -d '"' -f 4 | grep "$_arch")" ||
err "clashrup has not yet been packaged for your architecture ($_arch), please file an issue at https://github.com/spencerwooo/clashrup/issues"
err "mihoro has not yet been packaged for your architecture ($_arch), please file an issue at https://github.com/spencerwooo/mihoro/issues"

local _ext
case "$_package_url" in
Expand All @@ -96,7 +96,7 @@ download_clashrup() {
*) err "unsupported package format: $_package_url" ;;
esac

local _package="clashrup.$_ext"
local _package="mihoro.$_ext"
case "$_dld" in
curl) _releases="$(curl -sLo "$_package" "$_package_url")" || err "curl: failed to download $_package_url" ;;
wget) _releases="$(wget -qO "$_package" "$_package_url")" || err "wget: failed to download $_package_url" ;;
Expand Down
28 changes: 14 additions & 14 deletions src/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,39 @@ use clap::Subcommand;
#[derive(Parser)]
#[command(author, about, version)]
pub struct Args {
/// Path to clashrup config file
#[clap(short, long, default_value = "~/.config/clashrup.toml")]
pub clashrup_config: String,
/// Path to mihoro config file
#[clap(short, long, default_value = "~/.config/mihoro.toml")]
pub mihoro_config: String,
#[command(subcommand)]
pub command: Option<Commands>,
}

#[derive(Subcommand)]
pub enum Commands {
#[command(about = "Setup clashrup by downloading clash binary and remote config")]
#[command(about = "Setup mihoro by downloading mihomo binary and remote config")]
Setup,
#[command(about = "Update clash remote config, mmdb, and restart clash.service")]
#[command(about = "Update mihomo remote config, mmdb, and restart mihomo.service")]
Update,
#[command(about = "Apply clash config overrides and restart clash.service")]
#[command(about = "Apply mihomo config overrides and restart mihomo.service")]
Apply,
#[command(about = "Start clash.service with systemctl")]
#[command(about = "Start mihomo.service with systemctl")]
Start,
#[command(about = "Check clash.service status with systemctl")]
#[command(about = "Check mihomo.service status with systemctl")]
Status,
#[command(about = "Stop clash.service with systemctl")]
#[command(about = "Stop mihomo.service with systemctl")]
Stop,
#[command(about = "Restart clash.service with systemctl")]
#[command(about = "Restart mihomo.service with systemctl")]
Restart,
#[command(about = "Check clash.service logs with journalctl")]
#[command(about = "Check mihomo.service logs with journalctl")]
Log,
#[command(about = "Proxy export commands, `clashrup proxy --help` to see more")]
#[command(about = "Proxy export commands, `mihoro proxy --help` to see more")]
Proxy {
#[command(subcommand)]
proxy: Option<ProxyCommands>,
},
#[command(about = "Uninstall and remove clash and config")]
#[command(about = "Uninstall and remove mihomo and config")]
Uninstall,
#[command(about = "Generate shell completions for clashrup")]
#[command(about = "Generate shell completions for mihoro")]
Completions {
#[clap(subcommand)]
shell: Option<ClapShell>,
Expand Down
Loading

0 comments on commit 6eeb911

Please sign in to comment.