#xml #formatter #cli #modify

app xml_magic

A reasonably fast XML formatter

1 stable release

1.0.0 Dec 29, 2024

#227 in Text processing

Download history 111/week @ 2024-12-24 9/week @ 2024-12-31

120 downloads per month

MIT license

8KB
105 lines

xml_magic

A reasonably fast command-line XML formatter with proper indentation and comment preservation.

Installation

Using cargo-binstall (prebuilt binaries)

cargo binstall xml_magic

From crates.io

cargo install xml_magic

From source

# Clone the repository
git clone https://github.com/bolli24/xml_magic
cd xml_magic

# Build and install
cargo install --path .

Features

  • Fast XML formatting with customizable indentation
  • Preserves comments and structure
  • Multiple output options (in-place, stdout, or new file)
  • Support for tabs or space-based indentation

Usage

# Format in-place using tabs (default)
xml_magic path/to/file.xml

# Output to a different file
xml_magic path/to/file.xml --output path/to/output.xml

# Output to stdout instead of modifying files
xml_magic --stdout path/to/file.xml

# Customize indentation style
xml_magic --indent tab path/to/file.xml     # Use tabs (default)
xml_magic --indent two path/to/file.xml     # Use 2 spaces
xml_magic --indent four path/to/file.xml    # Use 4 spaces

Dependencies

~1.4–2MB
~37K SLoC