Add autocompletion to your scripts in bash | bash complete and compgen tutorial

Поділитися
Вставка
  • Опубліковано 23 січ 2025

КОМЕНТАРІ • 15

  • @11zoomzoom11
    @11zoomzoom11 14 днів тому

    Thanks brother, this worked great for my purposes.

  • @sojourner1973
    @sojourner1973 9 місяців тому

    Hi Evan, thank you very much for this, excellent tutorial !

  • @PranaTechCh
    @PranaTechCh Рік тому

    Very clear explanations, thanks a lot !

  • @YugoGautomo
    @YugoGautomo Рік тому

    Thanks a lot. very good tutorial on bash completion.

  • @EvenTheDogAgrees
    @EvenTheDogAgrees 17 днів тому

    Small correction; perhaps you just misspoke, perhaps you're unaware, but that # symbol is not a "hashtag". It's a hash, or the hash symbol. Hashtag is jargon from Twitter, where they used the hash symbol to denote that what followed, up to the next space symbol, was a tag. Hence hash-tag.
    Why they didn't just call it a tag is anyone's guess, since it's not like they needed to specify it's a _hash_ tag to differentiate it from all the other kinds of tags on the platform.

  • @tenjyosyu3673
    @tenjyosyu3673 Рік тому +1

    Thanks for your video,i l leaned a lot. I wonder if the command `local CURRENT_WORD=${COMP_WORDS[COMP_CWORD]}` in line 20 need to be edited as `local CURRENT_WORD=${COMP_WORDS[$COMP_CWORD]}`.

    • @evanugarte
      @evanugarte  Рік тому

      did it only work with the updated line 20? thanks for the suggestion

  • @jasonarg1997
    @jasonarg1997 Рік тому

    is there the whole script somewhere

  • @unknownEntity3232
    @unknownEntity3232 9 місяців тому

    I am new to bash, but not only I understood the concept and how it works, but I also learned a few things along the way!
    Now I am trying to implement this in some of my scripts and automatically invoke the autocomplete, but I can't make it work properly :/

    • @evanugarte
      @evanugarte  9 місяців тому

      are you using a bash terminal?

    • @unknownEntity3232
      @unknownEntity3232 9 місяців тому

      @@evanugartethanks for the reply! I am using zsh and I am on a mac.
      What I m working on is a function that provides steps to create a conventional commit. At some point I want the user to select a scope for the commit, and here is where I am trying to invoke the autocomplete function, but when I do so the prompt goes to the next line, and when tab is pressed only some spaces are added.

    • @evanugarte
      @evanugarte  9 місяців тому

      @@unknownEntity3232 I think auto complete is slightly different in zsh, i don't know the difference at the moment but have been meaning to learn for some time

    • @unknownEntity3232
      @unknownEntity3232 9 місяців тому

      @@evanugarte I think it has to do with the way that I invoke the autocomplete function inside the commit function. It feels like when the commit function reaches the autocomplete function, it simply prints out the name or something and goes to the next line, so when i press tab I do so in a new line.
      I belive it's either the autocomplete is not supposed to work as I am trying to make it work or that I am missing some kind of syntax somewhere.

  • @ripplewang-i9z
    @ripplewang-i9z Рік тому

    nice

  • @asaleminik
    @asaleminik 2 роки тому

    the double upload