Batchfile utilities for me
Directory bookmarking with fuzzy finder (directory moving from list & list management)
require: any interactive filter tool (like fuzzy finder, default is Heatseeker)
dhi rm
require: sd, rw
dhi edit
require: %EDITOR%
environment variable (or set in this bat)
dhi # pushd from `cat listfile.txt | fuzzy`
dhi add # add %cd% (like pwd) to list
dhi rm # remove %cd% from list
dhi list # printout directory list file
dhi edit # edit directory list file
Preview changes after do command to file
require: sd, cat (no deeper reason, so type
and @type %*
is maybe ok)
# Default is `diff` but can use other command
set "DIFFCMD=delta"
# You can see only differences ;)
after foo.txt -- sd foo bar
URL encode from argument text
require: nkf, sd
Usage:
Usage:
url [OPTION] [FILE]
Option:
-d, --decode Decode string
-h, --help Show this message
Example:
echo あいうえお| url
# %E3%81%82%E3%81%84%E3%81%86%E3%81%88%E3%81%8A
cd to rhq managed directory
require: rhq, tr(can replace with sd), cut, any interactive filter tool (set %SELCMD%
in/out of this bat)
Github repository searching, printout repo's name & description
Using Github api, but not support api token yet (and not planned now)
require: toenv.bat, url.bat, sd, rg, xq (that is one of jq clone)
Demo:
Github release URL getter, use fuzzy finder to select assets
Specify repository name from arguments (user/name format)
These error handling is not good, and behavior is dependent on Heatseeker's that
(if query is empty, ignore query specify option)
require: xq, teip, hs, sd, head (just in case for my use case, removable)
Example:
ghrel BurntSushi/ripgrep
# (selecting...)
# https://github.com/BurntSushi/ripgrep/releases/download/13.0.0/ripgrep-13.0.0-x86_64-pc-windows-msvc.zip
# Set initial selecting query
ghrel BurntSushi/ripgrep msvc
Minimum template expander (just a replacer)
require: sd
Example:
echo Hi, {{ name }}! | tet name=John
# Hi, John!
Command output to envvar
Usage:
USAGE:
toenv var="cmd"
piped command:
toenv var="cmd1 <args> ^| cmd2"
Stdin to command arg (for only oneline)
If argument is empty, just exec stdin as a command
Example:
echo https://example.com | toarg browser
Similar to toarg, but use fuzzy finder for take out single line, from multiline stdin (experimental)
Open URL in firefox private browsing
Example:
browser https://example.com
browser example.com
echo https://example.com | toarg browser
Toy clone of mattn/memo (not maintained now)
Grep with color specifying, shorthand of running ripgrep with --colors
option
core logic:
rg --colors "match:fg:%1"
Usage:
Usage:
cg <color> <pattern>
Available color list:
red, blue, green, cyan, magenta, yellow, white and black
Example:
echo foo bar baz | cg blue foo
echo foo bar baz | cg blue foo | cg green bar | cg yellow baz