Skip to content

Commit

Permalink
Task/tsp 722 adding .reset command (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
jharajeev55 authored Sep 10, 2024
1 parent c1ba7cd commit 85bd7ee
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
### Added

- VISA Support
- Added .reset command to Cancel any ongoing jobs and send *RST.

## [0.17.0]

Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ thiserror = "1.0.58"
tmc = { git = "https://github.com/esarver/rusb-usbtmc" }
tracing = { version = "0.1.40", features = ["async-await"] }
tracing-subscriber = { version = "0.3.18", features = ["json"] }
tsp-toolkit-kic-lib = { git = "https://github.com/tektronix/tsp-toolkit-kic-lib.git", tag = "v0.17.2-3" }
tsp-toolkit-kic-lib = { git = "https://github.com/tektronix/tsp-toolkit-kic-lib.git", tag = "v0.17.2-4" }



[workspace.lints.rust]
Expand Down
1 change: 1 addition & 0 deletions instrument-repl/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pub enum Request {
slot: Option<u16>,
},
Exit,
Reset,
Help {
sub_cmd: Option<String>,
},
Expand Down
19 changes: 19 additions & 0 deletions instrument-repl/src/repl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,10 @@ impl Repl {
info!("Exiting...");
break 'user_loop;
}
Request::Reset => {
self.inst.as_mut().reset()?;
prompt = true;
}
Request::Help { sub_cmd } => {
prompt = true;
if let Some(sub_cmd) = sub_cmd {
Expand Down Expand Up @@ -522,6 +526,15 @@ impl Repl {
Arg::new("path").required_unless_present("help")
)
)
.subcommand(
Command::new(".reset")
.help_template(SUBCMD_TEMPLATE)
.about("Cancel any ongoing jobs and send *RST.")
.disable_help_flag(true)
.arg(
Arg::new("help").short('h').long("help").help("Print help").action(ArgAction::SetTrue)
),
)
.disable_help_flag(true)
}

Expand Down Expand Up @@ -607,6 +620,12 @@ impl Repl {
Request::Script { file }
}
},
Some((".reset", flags)) => match flags.get_one::<bool>("help") {
Some(help) if *help => Request::Help {
sub_cmd: Some(".reset".to_string()),
},
_ => Request::Reset,
},
Some((".nodes", flags)) => match flags.get_one::<bool>("help") {
Some(help) if *help => Request::Help {
sub_cmd: Some(".nodes".to_string()),
Expand Down

0 comments on commit 85bd7ee

Please sign in to comment.