Files
tauri/crates/tauri-cli/src/main.rs
Amr Bashir 36eee37220 Restructure the repository (#10796)
* Restructure the repository

* lock file

* fmt

* fix bench

* fix cli template test

* remove accidental file

* fix mv command

* clippy

* upgrade paths-filter github action

* fix cli migration tests

* lockfile

* license headers

* clippy

* scope test-core to tauri crate

* license header

* correct --manifest-path usage

* lockfile

* fix tauri-driver on macOS [skip ci]

* build target ios

* try downgrade env_logger

* downgrade 0.1.7

* try to fix bench

* bench overflow

* revert overflow fix, fix tauri_root_path

* revert env_logger downgrade

* fmt

* raise msrv to 1.71

* fmt

* delete .cargo/config.toml [skip ci]

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2024-08-27 18:42:30 -03:00

44 lines
1.1 KiB
Rust

// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
#[cfg(not(any(target_os = "macos", target_os = "linux", windows)))]
fn main() {
println!("The Tauri CLI is not supported on this platform");
std::process::exit(1);
}
#[cfg(any(target_os = "macos", target_os = "linux", windows))]
fn main() {
use std::env::args_os;
use std::ffi::OsStr;
use std::path::Path;
use std::process::exit;
let mut args = args_os().peekable();
let bin_name = match args
.next()
.as_deref()
.map(Path::new)
.and_then(Path::file_stem)
.and_then(OsStr::to_str)
{
Some("cargo-tauri") => {
if args.peek().and_then(|s| s.to_str()) == Some("tauri") {
// remove the extra cargo subcommand
args.next();
Some("cargo tauri".into())
} else {
Some("cargo-tauri".into())
}
}
Some(stem) => Some(stem.to_string()),
None => {
eprintln!("cargo-tauri wrapper unable to read first argument");
exit(1);
}
};
tauri_cli::run(args, bin_name)
}