#command-line-tool #bash #utility #cli #text #filename

bin+lib xquo

Quote null splited lines for Bash command line

4 releases

0.2.2 Dec 8, 2024
0.2.1 Jul 4, 2023
0.2.0 Jul 26, 2022
0.1.1 Jul 20, 2022

#1480 in Command line utilities

Download history 23/week @ 2024-09-23 3/week @ 2024-09-30 87/week @ 2024-12-02 61/week @ 2024-12-09

148 downloads per month

MIT license

20KB
422 lines

xquo

Command line utility to quote null splited lines for Bash command line.

Installation

Using cargo

$ cargo install xquo

Using cargo with jemalloc feature

As far as I tried, it could be built in Ubuntu(x86_64-unknown-linux-musl) and Apine(x86_64-unknown-linux-gnu).

$ cargo install xquo --features jemalloc

From repository relases page

https://github.com/hankei6km/xquo/releases

Usage

A file name containing lf character exists.

$ ls
'123'$'\n''abc.txt'  '123 abc.txt'  '123"abc.txt'  "123'abc.txt"   abc.txt

$ find . -type f -exec echo ={}= \;
=./123
abc.txt=
=./123'abc.txt=
=./abc.txt=
=./123 abc.txt=
=./123"abc.txt=

Import the file list as a command line into the editor(ie. Vim).

$ find . -type f -print0 | xquo | vim "+%s/^/ls -l /" -
ls -l './123'$'\n''abc.txt'
ls -l './123'"'"'abc.txt'
ls -l './abc.txt'
ls -l './123 abc.txt'
ls -l './123"abc.txt'

These can access a file correctly.

:w !bash
-rw-r--r-- 1 vscode vscode 0 Jul  8 15:46 './123'$'\n''abc.txt'
-rw-r--r-- 1 vscode vscode 0 Jul  8 15:46 "./123'abc.txt"
-rw-r--r-- 1 vscode vscode 0 Jul  8 15:46 ./abc.txt
-rw-r--r-- 1 vscode vscode 0 Jul  8 15:46 './123 abc.txt'
-rw-r--r-- 1 vscode vscode 0 Jul  8 15:46 './123"abc.txt'

Press ENTER or type command to continue

License

MIT License

Copyright (c) 2022 hankei6km

Dependencies

~1.6–9MB
~88K SLoC