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
11 changes: 11 additions & 0 deletions src/internal_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,17 @@ pub fn cmd_pwd(
Ok(false)
}

// ===== "top" =====

pub fn cmd_top(
_commands: &Commands,
session: &mut Session,
_args: ParsedArgs,
) -> Result<bool, String> {
session.mode_config_top();
Ok(false)
}

// ===== "discard" =====

pub fn cmd_discard(
Expand Down
1 change: 1 addition & 0 deletions src/internal_commands.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@
<token name="exit" help="Exit from current mode." cmd="cmd_exit_config"/>
<token name="list" help="Print command list." cmd="cmd_list"/>
<token name="pwd" help="Display current mode path." cmd="cmd_pwd"/>
<token name="top" help="Return to top-level configuration mode." cmd="cmd_top"/>
<token name="show" help="Show information about the system.">
<token name="candidate" argument="configuration" help="Show candidate configuration." cmd="cmd_show_config">
<token name="format" help="Configuration format.">
Expand Down
6 changes: 6 additions & 0 deletions src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,12 @@ impl Session {
self.update_prompt();
}

pub fn mode_config_top(&mut self) {
let nodes = self.mode.as_configure_mut().unwrap();
nodes.clear();
self.update_prompt();
}

pub fn edit_candidate(
&mut self,
negate: bool,
Expand Down
1 change: 1 addition & 0 deletions src/token_xml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ fn parse_tag_token(
"cmd_exit_config" => internal_commands::cmd_exit_config,
"cmd_end" => internal_commands::cmd_end,
"cmd_pwd" => internal_commands::cmd_pwd,
"cmd_top" => internal_commands::cmd_top,
"cmd_discard" => internal_commands::cmd_discard,
"cmd_commit" => internal_commands::cmd_commit,
"cmd_validate" => internal_commands::cmd_validate,
Expand Down
Loading