-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use seahorse for actual CLI commands
- Loading branch information
1 parent
e7031bc
commit 75e4fa4
Showing
3 changed files
with
35 additions
and
231 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,33 +1,36 @@ | ||
use color_eyre::eyre::Result; | ||
use std::env; | ||
use seahorse::{App, Command}; | ||
use crosec::commands::{ | ||
get_chip_info::ec_cmd_get_chip_info, hello::ec_cmd_hello, version::ec_cmd_version, | ||
}; | ||
|
||
fn main() -> Result<()> { | ||
color_eyre::install()?; | ||
fn main() { | ||
let args: Vec<String> = env::args().collect(); | ||
let app = App::new(env!("CARGO_PKG_NAME")) | ||
.version(env!("CARGO_PKG_VERSION")) | ||
.command(Command::new("hello").action(|_c| { | ||
let status = ec_cmd_hello().unwrap(); | ||
if status { | ||
println!("EC says hello!"); | ||
} else { | ||
println!("EC did not say hello :("); | ||
} | ||
})) | ||
.command(Command::new("version").action(|_c| { | ||
let (ro_ver, rw_ver, firmware_copy, build_info, tool_version) = ec_cmd_version().unwrap(); | ||
println!("RO version: {ro_ver}"); | ||
println!("RW version: {rw_ver}"); | ||
println!("Firmware copy: {firmware_copy}"); | ||
println!("Build info: {build_info}"); | ||
println!("Tool version: {tool_version}"); | ||
})) | ||
.command(Command::new("chipinfo").action(|_c| { | ||
let (vendor, name, revision) = ec_cmd_get_chip_info().unwrap(); | ||
println!("Chip info:"); | ||
println!(" vendor: {vendor}"); | ||
println!(" name: {name}"); | ||
println!(" revision: {revision}"); | ||
})); | ||
|
||
println!("Hello command"); | ||
let status = ec_cmd_hello()?; | ||
if status { | ||
println!("EC says hello!"); | ||
} else { | ||
println!("EC did not say hello :("); | ||
} | ||
|
||
println!("Version command"); | ||
let (ro_ver, rw_ver, firmware_copy, build_info, tool_version) = ec_cmd_version()?; | ||
println!("RO version: {ro_ver}"); | ||
println!("RW version: {rw_ver}"); | ||
println!("Firmware copy: {firmware_copy}"); | ||
println!("Build info: {build_info}"); | ||
println!("Tool version: {tool_version}"); | ||
|
||
println!("Chip info command"); | ||
let (vendor, name, revision) = ec_cmd_get_chip_info()?; | ||
println!("Chip info:"); | ||
println!(" vendor: {vendor}"); | ||
println!(" name: {name}"); | ||
println!(" revision: {revision}"); | ||
|
||
Ok(()) | ||
app.run(args); | ||
} |