Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,13 @@ jobs:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- name: Build CLI
run: cargo build --release -p phishkit-cli --target ${{ matrix.target }}
# Bake the release version (tag without the leading `v`) into the CLI so
# `phishkit --version` reports the shipped build, not the Cargo default.
env:
PHISHKIT_VERSION: ${{ github.ref_name }}
run: |
export PHISHKIT_VERSION="${PHISHKIT_VERSION#v}"
cargo build --release -p phishkit-cli --target ${{ matrix.target }}
- name: Package
shell: bash
run: |
Expand Down
9 changes: 9 additions & 0 deletions apps/cli/src/phishkit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ use serde_json::json;

fn main() {
let mut args = env::args().skip(1).collect::<Vec<_>>();
if args.iter().any(|a| a == "-V" || a == "--version")
|| args.first().map(|a| a == "version").unwrap_or(false)
{
println!(
"phishkit {}",
option_env!("PHISHKIT_VERSION").unwrap_or(env!("CARGO_PKG_VERSION"))
);
process::exit(0);
}
let wants_help = args.is_empty()
|| args.iter().any(|a| a == "-h" || a == "--help")
|| args.first().map(|a| a == "help").unwrap_or(false);
Expand Down
9 changes: 9 additions & 0 deletions apps/cli/src/phishkit_ctl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ use serde_json::json;

fn main() {
let mut args = env::args().skip(1).collect::<Vec<_>>();
if args.iter().any(|a| a == "-V" || a == "--version")
|| args.first().map(|a| a == "version").unwrap_or(false)
{
println!(
"phishkit {}",
option_env!("PHISHKIT_VERSION").unwrap_or(env!("CARGO_PKG_VERSION"))
);
process::exit(0);
}
let wants_help = args.is_empty()
|| args.iter().any(|a| a == "-h" || a == "--help")
|| args.first().map(|a| a == "help").unwrap_or(false);
Expand Down
Loading