knighn edit

Edit JSX in project files with the project tab edit engine: select elements with a query, then change classes, text or props.

knighn edit [options] <FILE>
Argument What it is
FILE A .tsx or .jsx file of a project, or a glob such as "src/**/*.tsx" (more can follow)
Option What it does Default
-s, --select <select> Query: 12 or 12:5 (a line), tag, .class, #id, [prop=value], :text("words"), :nth(n), "a b" (descendant), "a > b" (child), "a, b" (either)
-c, --classes <classes> Classes to add (a conflicting class is replaced)
-r, --remove <remove> Classes to remove.
-b, --breakpoint <breakpoint> Write the classes under this prefix, such as md.
-t, --text <text> Replace the one text child.
-p, --prop <prop> Set a prop: name=value (repeatable)
--unset-prop <unset-prop> Remove a prop (repeatable)
--delete Delete the element.
--duplicate Duplicate the element after the change.
--all Edit every match (else more than one match refuses)
--host Go through Knighn when it has the project open (one undo step); --no-host writes the files here. true
--dry-run Show the change; write nothing.
--root <root> The project root. the nearest package.json
--json Output as JSON.