home.social

#argv — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #argv, aggregated by home.social.

fetched live
  1. Re prev toots, hypothetically, if I were to write a library called libextextglob that would grovel over an array of strings (like, say, #argv) and do horrible things to it if it sees globby characters that the shell didn't expand, would you think it was ...

    (updated to allow multiple choices, because the best crimes are in B♭ minor)

    #shell #unix #programming #bash

  2. Re prev toots, hypothetically, if I were to write a library called libextextglob that would grovel over an array of strings (like, say, ) and do horrible things to it if it sees globby characters that the shell didn't expand, would you think it was ...

    (updated to allow multiple choices, because the best crimes are in B♭ minor)

  3. Re prev toots, hypothetically, if I were to write a library called libextextglob that would grovel over an array of strings (like, say, #argv) and do horrible things to it if it sees globby characters that the shell didn't expand, would you think it was ...

    (updated to allow multiple choices, because the best crimes are in B♭ minor)

    #shell #unix #programming #bash

  4. Re prev toots, hypothetically, if I were to write a library called libextextglob that would grovel over an array of strings (like, say, #argv) and do horrible things to it if it sees globby characters that the shell didn't expand, would you think it was ...

    (updated to allow multiple choices, because the best crimes are in B♭ minor)

    #shell #unix #programming #bash

  5. Re prev toots, hypothetically, if I were to write a library called libextextglob that would grovel over an array of strings (like, say, #argv) and do horrible things to it if it sees globby characters that the shell didn't expand, would you think it was ...

    (updated to allow multiple choices, because the best crimes are in B♭ minor)

    #shell #unix #programming #bash

  6. My zshrc contains the following:

    setopt autocd
    function cd () {
    if (( ${#argv} == 1 )) && [[ -f ${1} ]]; then
    [[ ! -e ${1:h} ]] && return 1
    builtin cd ${1:h}
    else
    builtin cd "$@"
    fi
    }
    alias ...='../..'
    alias ....='../../..'
    alias .....='../../../..'

    This allows things like `cd /etc/fstab` to go to `/etc`, `...` to go 2 directories up and `/blah/fasel` to go to `/bla/fasel` without explicit `cd`.

    I am basically lost on machines without that. 😿

  7. My zshrc contains the following:

    setopt autocd
    function cd () {
    if (( ${#argv} == 1 )) && [[ -f ${1} ]]; then
    [[ ! -e ${1:h} ]] && return 1
    builtin cd ${1:h}
    else
    builtin cd "$@"
    fi
    }
    alias ...='../..'
    alias ....='../../..'
    alias .....='../../../..'

    This allows things like `cd /etc/fstab` to go to `/etc`, `...` to go 2 directories up and `/blah/fasel` to go to `/bla/fasel` without explicit `cd`.

    I am basically lost on machines without that. 😿

  8. My zshrc contains the following:

    setopt autocd
    function cd () {
    if (( ${#argv} == 1 )) && [[ -f ${1} ]]; then
    [[ ! -e ${1:h} ]] && return 1
    builtin cd ${1:h}
    else
    builtin cd "$@"
    fi
    }
    alias ...='../..'
    alias ....='../../..'
    alias .....='../../../..'

    This allows things like `cd /etc/fstab` to go to `/etc`, `...` to go 2 directories up and `/blah/fasel` to go to `/bla/fasel` without explicit `cd`.

    I am basically lost on machines without that. 😿

  9. My zshrc contains the following:

    setopt autocd
    function cd () {
    if (( ${#argv} == 1 )) && [[ -f ${1} ]]; then
    [[ ! -e ${1:h} ]] && return 1
    builtin cd ${1:h}
    else
    builtin cd "$@"
    fi
    }
    alias ...='../..'
    alias ....='../../..'
    alias .....='../../../..'

    This allows things like `cd /etc/fstab` to go to `/etc`, `...` to go 2 directories up and `/blah/fasel` to go to `/bla/fasel` without explicit `cd`.

    I am basically lost on machines without that. 😿

  10. My zshrc contains the following:

    setopt autocd
    function cd () {
    if (( ${#argv} == 1 )) && [[ -f ${1} ]]; then
    [[ ! -e ${1:h} ]] && return 1
    builtin cd ${1:h}
    else
    builtin cd "$@"
    fi
    }
    alias ...='../..'
    alias ....='../../..'
    alias .....='../../../..'

    This allows things like `cd /etc/fstab` to go to `/etc`, `...` to go 2 directories up and `/blah/fasel` to go to `/bla/fasel` without explicit `cd`.

    I am basically lost on machines without that. 😿

  11. Знайшов ще одну не погану C++ бібліотеку для розбору вхідних аргументів програми. Називається TCLAP (Templatized C++ Command Line Parser). Вона є header-only тому зібрати набагато простіше, але мені таке не дуже подобається. Подивитись більше інформації з прикладами можна тут. Поширюється бібліотека під ліцензією MIT.

    На жаль стандартне форматування помилок, довідки й версії не дуже звичне, але досить просто можна замінити на своє власне. Також було б непогано додати сучасні constexpr і таким чином пришвидшити виконання. А якщо у C++26 нарешті зʼявиться рефлексія. А з використанням C++23 можна було б замінити динамічний поліморфізм на статичний (CRTP). Ну це я вже дуже розмріявся.

    #cpp #cxx #argv #args #parsing #parser #cli #lib #library #tclap #headeronly

  12. Знайшов ще одну не погану C++ бібліотеку для розбору вхідних аргументів програми. Називається TCLAP (Templatized C++ Command Line Parser). Вона є header-only тому зібрати набагато простіше, але мені таке не дуже подобається. Подивитись більше інформації з прикладами можна тут. Поширюється бібліотека під ліцензією MIT.

    На жаль стандартне форматування помилок, довідки й версії не дуже звичне, але досить просто можна замінити на своє власне. Також було б непогано додати сучасні constexpr і таким чином пришвидшити виконання. А якщо у C++26 нарешті зʼявиться рефлексія. А з використанням C++23 можна було б замінити динамічний поліморфізм на статичний (CRTP). Ну це я вже дуже розмріявся.

    #cpp #cxx #argv #args #parsing #parser #cli #lib #library #tclap #headeronly

  13. Some days you don’t get your own stuff done, but you do point out to someone else that they have loaded a high-caliber #footgun.

    #Sanitize your input, folks, and jealously guard your #argc and #argv.