-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bump [archspec-json](https://github.com/archspec/archspec-json) and adds a small binary to works similarly to the archspec python implementation. ``` archspec command line interface Usage: archspec.exe <COMMAND> Commands: cpu archspec command line interface for CPU help Print this message or the help of the given subcommand(s) Options: -h, --help Print help -V, --version Print version ```
- Loading branch information
1 parent
a88dffa
commit ff45a9b
Showing
5 changed files
with
47 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[package] | ||
name = "archspec-bin" | ||
version = "0.1.0" | ||
edition = "2021" | ||
publish = false | ||
|
||
[dependencies] | ||
archspec = { path = ".." } | ||
clap = { version = "4.5.4", features = ["derive"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use clap::{Parser, Subcommand}; | ||
|
||
/// Simple program to greet a person | ||
#[derive(Parser, Debug)] | ||
#[command(version, about = "archspec command line interface", long_about = None)] | ||
struct Args { | ||
#[command(subcommand)] | ||
command: Command, | ||
} | ||
|
||
#[derive(Subcommand, Clone, Debug)] | ||
enum Command { | ||
/// archspec command line interface for CPU | ||
Cpu, | ||
} | ||
|
||
fn main() { | ||
let args = Args::parse(); | ||
match args.command { | ||
Command::Cpu => detect_cpu(), | ||
} | ||
} | ||
|
||
fn detect_cpu() { | ||
match archspec::cpu::host() { | ||
Ok(arch) => println!("{}", arch.name()), | ||
Err(_err) => eprintln!("Error: unsupported micro architecture"), | ||
} | ||
} |