# <https://github.com/gleitz/howdoi>
declare-option -hidden str howdoicmd 'howdoi -n 5'
# <https://github.com/mawww/kakoune/blob/master/rc/tools/grep.kak>
define-command -params .. \
-docstring %{howdoi [<arguments>]: howdoi --help
All the optional arguments are forwarded to the howdoi utility
Instant coding answers via the command line
<https://github.com/gleitz/howdoi>} \
howdoi %{ evaluate-commands %sh{
output=$(mktemp -d "${TMPDIR:-/tmp}"/kak-howdoi.XXXXXXXX)/fifo
mkfifo ${output}
if [ $# -gt 0 ]; then
( ${kak_opt_howdoicmd} "$@" > ${output} 2>&1 & ) > /dev/null 2>&1 < /dev/null
else
( ${kak_opt_howdoicmd} "${kak_selection}" > ${output} 2>&1 & ) > /dev/null 2>&1 < /dev/null
fi
printf %s\\n "evaluate-commands %{
edit! -fifo ${output} *howdoi*
hook -always -once buffer BufCloseFifo .* %{ nop %sh{ rm -r $(dirname ${output}) } }
}"
}}
Defaults to -n 5 answers and terminal does not render colour flag -c
see test_howdoi.py for system settings/usage.
:howdoi format date bash
Summary
★ Answer from https://stackoverflow.com/questions/1401482/yyyy-mm-dd-format-date-in-shell-script ★
# put current date as yyyy-mm-dd in $date
# -1 -> explicit current date, bash >=4.3 defaults to current time if not provided
# -2 -> start time for shell
printf -v date '%(%Y-%m-%d)T\n' -1
# put current date as yyyy-mm-dd HH:MM:SS in $date
printf -v date '%(%Y-%m-%d %H:%M:%S)T\n' -1
# to print directly remove -v flag, as such:
printf '%(%Y-%m-%d)T\n' -1
# -> current date printed to terminal
Yeah tldr and a short term hope but a long term plan is implementation like explain-shell.kak spit screen and the ability to append to buffer. All requests are cached by howdoi so maybe, maybe not save temp file, probably not, but maybe save search pattern to perfect a search string.
If anyone knows the author ath3 give him a tap on the shoulder point him over here and say: “mate it’s amateur hour, time to crack the knuckles and show this bloke how its done”.
Or anyone else who just wants to give me sh#t and turn this into a kakoune plugin or feature like man.kak for time.