Release 2.2.0 of an ack Bash Completion

Jonas Brømsø - Apr 26 '22 - - Dev Community

A long time ago I fooled around with Bash completions and I created several. I created a basic one for the marvellous grep alternative ack, which I open sourced in a GitHub repository.

At some point I started using ag (the silver searcher), and was no longer using ack as much as I used to.

I had actually forgotten all about it when, much to my surprise, I received a notification about an issue in the repository, the first one ever actually.

The issue was filed by @rpgoldman, who had an improved version of the completion, based on my initial work. I kindly requested @rpgoldman created a PR to sort of inspect the proposed changes in a more streamlined manner.

The proposed changes, where most fulfilling and extends the Bash completion, quite a lot from my very basic implementation.

My first implementation and parsed my .ackrc and created completions for my custom types.

The new release reimplements this and extracts the custom types from ack together with all the additional goodness ack offers.

So if you do ack -<tab>

You get:

--actionscript
--ada
--after-context
--asm
--asp
--aspx
--bar
--batch
--bazel
--before-context
--break
--cathy
--cc
--cfmx
--clojure
--cmake
--coffeescript
--color
--color-colno
--color-filename
--color-lineno
--color-match
--column
--conf
--context
--count
--cpp
--csharp
--css
--dart
--delphi
--dump
--elisp
--elixir
--elm
--env
--erlang
--files-with-matches
--files-without-matches
--filter
--flush
--follow
--fortran
--go
--groovy
--group
--gsp
--haskell
--heading
--help
--help-colors
--help-rgb-colors
--help-types
--hh
--hpp
--html
--ignore-case
--ignore-dir
--ignore-directory
--ignore-file-r
--invert-match
--jade
--java
--js
--json
--jsp
--known-types
--kotlin
--less
--lisp
--literal
--lua
--make
--man
--markdown
--match
--matlab
--mojo
--no-filename
--no-ignore-case
--no-recurse
--nobreak
--nocolor
--nocolumn
--noenv
--nofilter
--nofollow
--nogroup
--noheading
--noignore-dir
--noignore-directory
--nopager
--nosmart-case
--nounderline
--objc
--objcpp
--ocaml
--output
--pager
--passthru
--pconf
--perl
--perltest
--php
--plone
--pod
--print0
--proximate
--purescript
--python
--rake
--range-end
--range-start
--recurse
--rr
--rst
--ruby
--rust
--sass
--scala
--scheme
--shell
--show-types
--smalltalk
--smart-case
--smarty
--sort-files
--sql
--stylus
--svg
--swift
--tcl
--tex
--thpppt
--toml
--ts
--ttml
--type
--underline
--vb
--verilog
--version
--vhdl
--vim
--with-filename
--word-regexp
--xml
--yaml
-1
-A
-B
-c
-C
-f
-g
-h
-H
-i
-I
-k
-l
-L
-n
-o
-p
-Q
-R
-s
-S
-t
-T
-v
-w
-x
Enter fullscreen mode Exit fullscreen mode

This is based on my installation, so your set might look different, since I have custom extensions for:

  • *.conf
  • *.mojo
  • *.pconf

Please visit beyondgrep.com for more information on ack and all of the command line options, which you can have completions for.

This little venture taught me two things:

  1. Open source your things, not matter how big or small, finished or semi-finished - I can be useful to others
  2. Open source is for the patient - so even after years, somebody might contribute back; Go to 1.

Thanks to @rpgoldman for his contribution.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .