Add display.show_title option to display command titles in output (#439)

This commit is contained in:
hex1c 2025-10-03 23:23:25 +05:30 committed by GitHub
commit 5b306756af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 132 additions and 3 deletions

View file

@ -807,6 +807,42 @@ fn test_correct_rendering_with_config() {
.stdout(diff(expected));
}
/// An end-to-end integration test for rendering with show_title config option enabled.
#[test]
fn test_show_title_config() {
// Test that default behavior without show_title shows no title
let testenv = TestEnv::new().install_default_cache();
let expected_no_title = include_str!("rendered/inkscape-default.expected");
testenv
.command()
.args(["--color", "always", "inkscape-v2"])
.assert()
.success()
.stdout(diff(expected_no_title));
// Configure to enable show_title
testenv.append_to_config("display.show_title = true\n");
let expected_no_color = include_str!("rendered/inkscape-with-title-no-color.expected");
testenv
.command()
.args(["inkscape-v2"])
.assert()
.success()
.stdout(diff(expected_no_color));
let expected = include_str!("rendered/inkscape-with-title.expected");
testenv
.command()
.args(["--color", "always", "inkscape-v2"])
.assert()
.success()
.stdout(diff(expected));
}
#[test]
fn test_spaces_find_command() {
let testenv = TestEnv::new().install_default_cache();

View file

@ -0,0 +1,34 @@
inkscape
An SVG (Scalable Vector Graphics) editing program.
Use -z to not open the GUI and only process files in the console.
Open an SVG file in the Inkscape GUI:
inkscape filename.svg
Export an SVG file into a bitmap with the default format (PNG) and the default resolution (90 DPI):
inkscape filename.svg -e filename.png
Export an SVG file into a bitmap of 600x400 pixels (aspect ratio distortion may occur):
inkscape filename.svg -e filename.png -w 600 -h 400
Export a single object, given its ID, into a bitmap:
inkscape filename.svg -i id -e object.png
Export an SVG document to PDF, converting all texts to paths:
inkscape filename.svg | inkscape | inkscape --export-pdf=inkscape.pdf | inkscape | inkscape --export-text-to-path
Duplicate the object with id="path123", rotate the duplicate 90 degrees, save the file, and quit Inkscape:
inkscape filename.svg --select=path123 --verb=EditDuplicate --verb=ObjectRotate90 --verb=FileSave --verb=FileQuit
Some invalid command just to test the correct highlighting of the command name:
inkscape --use-inkscape=v3.0 file

View file

@ -0,0 +1,34 @@
inkscape
An SVG (Scalable Vector Graphics) editing program.
Use -z to not open the GUI and only process files in the console.
Open an SVG file in the Inkscape GUI:
 inkscape filename.svg
Export an SVG file into a bitmap with the default format (PNG) and the default resolution (90 DPI):
 inkscape filename.svg -e filename.png
Export an SVG file into a bitmap of 600x400 pixels (aspect ratio distortion may occur):
 inkscape filename.svg -e filename.png -w 600 -h 400
Export a single object, given its ID, into a bitmap:
 inkscape filename.svg -i id -e object.png
Export an SVG document to PDF, converting all texts to paths:
 inkscape filename.svg | inkscape | inkscape --export-pdf=inkscape.pdf | inkscape | inkscape --export-text-to-path
Duplicate the object with id="path123", rotate the duplicate 90 degrees, save the file, and quit Inkscape:
 inkscape filename.svg --select=path123 --verb=EditDuplicate --verb=ObjectRotate90 --verb=FileSave --verb=FileQuit
Some invalid command just to test the correct highlighting of the command name:
 inkscape --use-inkscape=v3.0 file