GCC Picks Up Meaningful Bash Completion Support To Help With Compiler Options

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • phoronix
    Administrator
    • Jan 2007
    • 67063

    GCC Picks Up Meaningful Bash Completion Support To Help With Compiler Options

    Phoronix: GCC Picks Up Meaningful Bash Completion Support To Help With Compiler Options

    One of the advantages of the LLVM Clang compiler has been better integration with Bash completion support, but now the GCC compiler supports a --completion argument for feeding into the Bash completion script with better matching of supported options/values when typing into a supported terminal...

    Phoronix, Linux Hardware Reviews, Linux hardware benchmarks, Linux server benchmarks, Linux benchmarking, Desktop Linux, Linux performance, Open Source graphics, Linux How To, Ubuntu benchmarks, Ubuntu hardware, Phoronix Test Suite
  • cybertraveler
    Senior Member
    • Nov 2017
    • 1102

    #2
    Nice.

    It's a shame that GCC doesn't use the standard GNU style options ('--' prefix for long opts and '-' prefix for short, single-letter opts). I guess it's far too late to change now. If they wanted to switch over they could create a new single letter option which dropped GCC into a GNU style option mode for all options that follow it. That would be backwards compatible.

    Comment

    • pal666
      Senior Member
      • Apr 2013
      • 9107

      #3
      Originally posted by cybertraveler View Post
      It's a shame that GCC doesn't use the standard GNU style options ('--' prefix for long opts and '-' prefix for short, single-letter opts).
      not sure where did you get that from. current article is about gnu style option --completion

      Comment

      • cybertraveler
        Senior Member
        • Nov 2017
        • 1102

        #4
        Originally posted by pal666 View Post
        not sure where did you get that from. current article is about gnu style option --completion
        $ man gcc

        There's some options which have a double-dash prefix. Very few though and because it doesn't follow the normal conventions you can't do stuff like stack multiple single letter options behind a single dash (which you would be able to do if it did follow the convention).
        Last edited by cybertraveler; 29 June 2018, 12:14 PM. Reason: "can't do" not "can do"

        Comment

        • garegin
          Senior Member
          • Nov 2011
          • 520

          #5
          Bash completion was turned on by most distros two years ago. It was so annoying that typing sudo in front of a command makes it not autocomplete.

          Comment

          • Vistaus
            Senior Member
            • Jul 2013
            • 5102

            #6
            Nah, fish is still my favorite (use it every day and it has so many great functions and remembers the commands you enter inside a specific folder!).

            Comment

            • cybertraveler
              Senior Member
              • Nov 2017
              • 1102

              #7
              Originally posted by garegin View Post
              Bash completion was turned on by most distros two years ago. It was so annoying that typing sudo in front of a command makes it not autocomplete.
              Anyone could have created a bash auto completion function for GCC (or any command for that matter) prior to this new feature. The benefit of this new GCC feature is that it should make it far easier to implement this auto completion, because gcc can now dump all the options in a nice format to the bash autocomplete function. This also has the benefit that if GCC is updated to give it a new command line option, the bash autocomplete function for GCC will not have to be updated to; if it's using this new 'complete' option, it will automatically pick up the new option. This may also be faster than some existing bash auto complete solutions. I don't know how it's currently done, but it could, for instance, be parsing a man page to find the options. This parsing is probably pretty slow compared to the time it would take to run gcc with this new option and use its specially formatted output.

              Comment

              • cybertraveler
                Senior Member
                • Nov 2017
                • 1102

                #8
                Originally posted by Vistaus View Post
                Nah, fish is still my favorite (use it every day and it has so many great functions and remembers the commands you enter inside a specific folder!).
                I really like the look of fish. It looks superior to bash. However I stick with bash because:
                1. I already know it.
                2. It's good enough for what I use it for.
                3. It's pretty much installed by default on every distro and it's often the default shell.
                4. Even if it's not installed by default it's almost certainly available in the default repositories by default even for the most obscure distros.
                5. Even if I used fish, I'd likely have to have bash on my system anyway either for the system to function normally, or to run other people's shell scripts.
                6. Many distros these days (eg Ubuntu) give a nicer out-of-box bash experience. Auto-complete is already setup and working for most apps on the system.
                7. Third party software vendors are more likely to provide bash auto-completion support than fish auto-completion support.
                8. Bash is a POSIX compliant shell.

                What I said about bash and fish also applies to POSIX in general. There's a lot of areas where the POSIX design could be improved IMO. However; the cost of improving these areas really outweighs the cons of losing compatibility, familiarity and all the other *ity things

                Comment

                • eltomito
                  Senior Member
                  • Jul 2013
                  • 124

                  #9
                  I couldn't care less about compiler command line auto completion. The compiler gets run by make which runs on files generated by cmake or automake. So, what's the big deal?

                  Comment

                  • andreano
                    Senior Member
                    • Jun 2012
                    • 594

                    #10
                    How much source code hasn't been lost to this beginner mistake:

                    gcc main.c -o m<tab><enter>

                    Comment

                    Working...
                    X