Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New xml format #7947

Merged
merged 17 commits into from
Mar 11, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add flags for keeping comments and processing instructions
  • Loading branch information
NotLebedev committed Feb 2, 2023
commit 1d67bc189a61f1815a059c744d60c086d391c6f1
4 changes: 4 additions & 0 deletions crates/nu-command/src/formats/from/xml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ impl Command for FromXml {
fn signature(&self) -> Signature {
Signature::build("from xml")
.input_output_types(vec![(Type::String, Type::Record(vec![]))])
.switch("keep-comments", "add comment nodes to result", None)
.switch("keep-processing-instructions", "add processing instruction nodes to result", None)
.category(Category::Formats)
}

Expand All @@ -35,6 +37,8 @@ impl Command for FromXml {
input: PipelineData,
) -> Result<PipelineData, ShellError> {
let head = call.head;
let keep_comments = call.has_flag("keep-comments"); // TODO: implement
let keep_processing_instructions = call.has_flag("keep-processing-instructions"); // TODO: implement
from_xml(input, head)
}

Expand Down