At present, xxd -i will always create an output file either with no variables (if stdin is used as input), or with variables with names
based on the input filename/path. In particular:
It'd be very convenient to allow overriding these names (or providing them at all in the case of stdin), particularly since they're based on the exact argument passed to xxd, which may be an absolute path. (No one would want to have to access variables based on the absolute path name in their code!)
This patch adds a -n option, which accepts a new variable name as an argument. This variable name is used for the data, and _len is appended to it for the length variable. Both still have special characters stripped and replaced with '_', and are capitalised if -C is used.
For example:
xxd -i -n myvar ~/data.dat
produces the following variables:
unsigned char myvar[]unsigned int myvar_lenunsigned char _home_david_data_datunsigned int _home_david_data_dat_lenhttps://github.com/vim/vim/pull/10599
(1 file)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
runtime/doc/xxd.man.1 should be also updated.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Merging #10599 (852c275) into master (e366ed4) will increase coverage by
0.89%.
The diff coverage isn/a.
@@ Coverage Diff @@ ## master #10599 +/- ## ========================================== + Coverage 81.70% 82.59% +0.89% ========================================== Files 158 148 -10 Lines 185384 172729 -12655 Branches 41931 39053 -2878 ========================================== - Hits 151463 142669 -8794 + Misses 21459 17464 -3995 - Partials 12462 12596 +134
| Flag | Coverage Δ | |
|---|---|---|
| huge-clang-none | 82.59% <ø> (-0.01%) |
⬇️ |
| linux | 82.59% <ø> (-0.01%) |
⬇️ |
| mingw-x64-HUGE | ? |
|
| mingw-x64-HUGE-gui | ? |
|
| windows | ? |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/highlight.c | 78.69% <0.00%> (-2.70%) |
⬇️ |
| src/time.c | 87.08% <0.00%> (-2.56%) |
⬇️ |
| src/misc2.c | 86.38% <0.00%> (-2.52%) |
⬇️ |
| src/buffer.c | 84.15% <0.00%> (-2.39%) |
⬇️ |
| src/help.c | 80.07% <0.00%> (-2.38%) |
⬇️ |
| src/session.c | 63.15% <0.00%> (-1.94%) |
⬇️ |
| src/menu.c | 81.37% <0.00%> (-1.83%) |
⬇️ |
| src/gui.c | 71.19% <0.00%> (-1.78%) |
⬇️ |
| src/arglist.c | 83.83% <0.00%> (-1.72%) |
⬇️ |
| src/vim9cmds.c | 85.16% <0.00%> (-1.70%) |
⬇️ |
| ... and 129 more |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered by Codecov. Last update e366ed4...852c275. Read the comment docs.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@sulix pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
runtime/doc/xxd.man.1should be also updated.
Thanks — I've updated runtime/doc/xxd.1. I haven't regenerated xxd.man, as it's adding a bunch of extra formatting changes here. I can look into whatever settings need changing and do so if that's desired, though. Similarly, I haven't attempted to update the translated pages.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Please add a test for this in src/testdir/test_xxd.vim
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Please add a test for this in src/testdir/test_xxd.vim
Thanks — I've added tests 17 and 18 to Test_xxd(), and they pass:
From test_xxd.vim:
Executed Test_xxd() in 0.400411 seconds
Executed Test_xxd_bit_dump() in 0.007860 seconds
Executed Test_xxd_c0_is_def_cols() in 0.170939 seconds
Executed Test_xxd_ignore_garbage() in 0.007741 seconds
Executed Test_xxd_max_cols() in 0.068192 seconds
Executed Test_xxd_min_cols() in 0.131794 seconds
Executed Test_xxd_patch() in 0.121765 seconds
Executed Test_xxd_plain_one_line() in 0.028997 seconds
Executed Test_xxd_usage() in 0.065982 seconds
Executed Test_xxd_version() in 0.011954 seconds
Executed 10 tests in 1.022748 seconds
(I thought of putting them next to tests 8 and 9, which are the other tests for -i, but thought that renumbering the other tests was not worth it. Happy to move them if you disagree, though.)
I've also rebased the change to the latest git version: there were no conflicts.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()