New and Noteworthy
`cat`
The `ls`, `tree` and `find` commands all eventually *enumerate* nodes, and the `--format` option permits to select *columns* among a predefined set of properties.
The new `cat` built-in permits to access:
- the values of all defined node properties
- almost complete *contents* of node bindings and property specifications
It's simple while quite handy:
/
> cat &qspi/$* -l
Property Type Value
────────────────────────────────────────────────────────────────────────────────────────
interrupts array < 0x29 0x01 >
pinctrl-0 phandles < &qspi_default >
reg array < 0x40029000 0x1000 0x12000000 0x08000000 >
status string "okay"
compatible string-array "nordic,nrf-qspi"
reg-names string-array "qspi", "qspi_mm"
wakeup-source boolean false
zephyr,pm-device-runtime-auto boolean false
pinctrl-1 phandles < &qspi_sleep >
pinctrl-names string-array "default", "sleep"
/
> cat &qspi/mx25r6435f0$quad-enable-requirements -Bl
Name: quad-enable-requirements
From: nordic,qspi-nor.yaml
Type: string
Required: No
Deprecated: No
Enum: "NONE", "S2B1v1", "S1B6", "S2B7", "S2B1v4", "S2B1v5", "S2B1v6"
Const: Not a const
Default: "S1B6"
Specifier Space: No specifier space
/
> cat &led0 -lB
Compatible: This binding does not define a compatible string.
Bus: This binding neither provides nor depends on buses.
Child-Bindings: gpio-leds
└── GPIO LED child node
Property Type Description
────────────────────────────────────────────────────────────────────────────────────────
gpios phandle-array
label string Human readable string describing the LED. It can be used by an…
Batch mode
For scripting and automation, DTSh can now execute non-interactively:
- a series of commands passed as program arguments: ``dtsh -c CMD1 -c CMD2 ...``
- commands form a script file: `dtsh -f FILE`
The ``-i --interactive`` option then permits to enter the interactive loop after the batch commands have been executed, as desired.
The `-c` option is especially practical on POSIX shells, where you can define aliases, e.g.:
sh
An alias to export the devicetree to HTML without leaving the operating system shell.
alias dts2html='dtsh -c "tree --format NKiYcd > devicetree.html"'
Combined with the pager, scripts allow to create simple *presentations*:
First "slide"
Start with the tree of buses and connected devices: speaker will press "q" when done
find --with-bus * --OR --on-bus * --format NYcd -T --pager
Let's look at the Flash partitions.
1st, the controller: : speaker will press "q" when done
cat &flash_controller -A --pager
Then partitions with addresses and sizes: speaker will press "q" when done
tree &flash_controller --format NrC --pager
Etc.
If the script is run with "-i", DTSh will enter the interactive loop
after the last command: speaker can then navigate the command history
to re-open "slides" while answering questions.
Many thanks to pillo79 who pushed this forward and contributed to the implementation ([PR 4](https://github.com/dottspina/dtsh/pull/4)).
Updated output redirection policy
By default, DTSh does not permit to overwrite existing files when redirecting commands output.
While this is a welcome precaution, this also breaks *appending* (`>>`):
/
> ls > ls.txt
/
> ls >> ls.txt
dtsh: file exists: 'ls.txt'
The preference `pref_fs_no_overwrite` is still set by default, but now bypassed when appending commands output.
Set the new `pref_fs_no_overwrite_strict` preference to never overwrite existing files.
Full Changelog
https://github.com/dottspina/dtsh/compare/v0.2.0...v0.2.1