hr icon indicating copy to clipboard operation
hr copied to clipboard

[Feature request] Config hr default text `#` through environment variable

Open NNBnh opened this issue 3 years ago • 2 comments

Hello, I think the option to customize the default text (when running hr without argument) via environment variable will be a nice feature:

export HR_DEFAULT_TEXT="<text>"

I suggest using HR_DEFAULT_TEXT instead of HR_DEFAULT_WORD like from the code:

hrs() {
    local WORD

    for WORD in "${@:-#}"
    do
        hr "$WORD"
    done
}

because if (by some reason) we type:

hr 'The quick brown fox jumps over the lazy dog'

then it is definitely not a word :(

BTW, thank you for inspiring me to create hr (SuperB HR), a portable posix shell hr.

NNBnh avatar Feb 27 '21 16:02 NNBnh

Hey @NNBnh,

Thank you so much for taking the time to suggest this feature! I don't understand in which context would it help to have it, is it in a scenario where you're running hr multiple times and want to have a different output for all those calls are there other advantages to having it do that?

As for the use of WORD I totally agree, it should be text like you suggest or even string, but I'd only change it if I touch the code again to add a new feature, or fix something.

PS: hr looks awesome! I love the logo :smiley:

LuRsT avatar Apr 02 '21 16:04 LuRsT

Hi @LuRsT,

Thank you so much for taking the time to suggest this feature! I don't understand in which context would it help to have it, is it in a scenario where you're running hr multiple times and want to have a different output for all those calls are there other advantages to having it do that?

I thinks this feature is just for convention. without create an alias: hr="hr ${@-DEFAULT_TEXT_}", user can type:

$ hr
DEFAULT_TEXT_DEFAULT_TEXT_DEFAULT_TEXT_

which is shorter than:

$ hr "DEFAULT_TEXT_"
DEFAULT_TEXT_DEFAULT_TEXT_DEFAULT_TEXT_

As for the use of WORD I totally agree, it should be text like you suggest or even string, but I'd only change it if I touch the code again to add a new feature, or fix something.

Yeah, string make more sense than text.

PS: hr looks awesome! I love the logo 😃

Thank you :D

NNBnh avatar Apr 03 '21 05:04 NNBnh