[gdal-dev] Any way to get an autocompletion for ogr/gdal utilities?
Thomas Gratier
osgeo.mailinglist at gmail.com
Fri Feb 4 11:01:52 PST 2022
Hi Markus,
Thanks for your answer. I'm on Linux box rather old e.g Ubuntu 18.04. My
shell is bash.
I do not find any files for autocompletion within
/usr/share/bash-completion/ related to ogr2ogr or any other GDAL binaries
or elsewhere.
I've also tried to see the behaviour using gdal within conda and no
autocompletion available too.
I've tried to test autocompletion within a zsh shell in case the issue
could have been related to zsh "smartness" but no change.
So, what I've done after this various unsuccessful tests is looking at
packages version of Ubuntu and I have found the issue.
Conclusion: I'm on an Ubuntu box too old
No GDAL autocompletion on below versions
- Bionic (18.04 LTS)
https://packages.ubuntu.com/bionic/amd64/gdal-bin/filelist
- Focal (20.04 LTS)
https://packages.ubuntu.com/focal/amd64/gdal-bin/filelist
GDAL Autocompletion available on
- Hirsute (21.04)
https://packages.ubuntu.com/hirsute/amd64/gdal-bin/filelist
- Impish (21.10) https://packages.ubuntu.com/impish/amd64/gdal-bin/filelist
- Jammy (22.04 upcoming LTS)
https://packages.ubuntu.com/jammy/amd64/gdal-bin/filelist
The remaining issue would be about not getting autocompletion with conda
although I tried with the latest version 3.4.1. I think I will open an
issue at https://github.com/conda-forge/gdal-feedstock/
Regards
Thomas Gratier
Le jeu. 3 févr. 2022 à 11:02, Markus Neteler <neteler at osgeo.org> a écrit :
> Hi Thomas,
>
> On Wed, Feb 2, 2022 at 11:59 PM Thomas Gratier
> <osgeo.mailinglist at gmail.com> wrote:
> >
> > Hello,
> >
> > On Linux, when I type `ogr` in a command line, and on the keyboard type
> on "tab" key, I get all binaries starting with `ogr` e.g
> >
> > > ogr2ogr ogrinfo ogrlineref ogrmerge.py ogrtindex
> >
> > When using command line like git, I type `git commit --` then use again
> the tab key and it returns something like below
> >
> > > --ahead-behind --date= --include
> --no-verify --reedit-message= --status
> > > --all --dry-run --interactive --null
> --reset-author --template=
> > > --amend --edit --long --only
> --reuse-message= --untracked-files
> > > --author= --file= --message= --patch
> --short --verbose
> > > --branch --fixup= --no-edit
> --porcelain --signoff --verify
> > > --cleanup= --gpg-sign --no-post-rewrite --quiet
> --squash=
> >
> > So, I do expect a way to get autocompletion or choice when I do
> something like `ogr2ogr -` followed by typing on tab key.
> >
> > Is there an existing script or a tip I'm not aware? Or do I need to work
> to create it to get something similar to git command where there is a
> script to add autocompletion?
>
> AFAIK this requires bash/zsh completion support.
>
> E.g., for core Git, on my Fedora box it is defined in
>
> /usr/share/bash-completion/completions/git
>
> and part of the package:
> rpm -qf /usr/share/bash-completion/completions/git
> git-core-2.34.1-1.fc35.x86_64
>
> Likewise, there is
>
> /usr/share/bash-completion/completions/ogr2ogr
> /usr/share/bash-completion/completions/ogrinfo
> /usr/share/bash-completion/completions/ogrlineref
> /usr/share/bash-completion/completions/ogrmerge.py
> /usr/share/bash-completion/completions/ogrtindex
> ...
>
> Here it works:
> ogrinfo --<tab>
> --config --format --help-general --locale --pause
> --debug --formats --license --optfile --version
>
> Maybe you package installation is incomplete?
>
> Best,
> Markus
>
> --
> Markus Neteler, PhD
> https://www.mundialis.de - free data with free software
> https://grass.osgeo.org
> https://courses.neteler.org/blog
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20220204/1a524ebc/attachment.html>
More information about the gdal-dev
mailing list