[GRASS5] Readline completion for grass

Hi all,

With some recent threads about immediate availability of layers list, column
names and so on, I recalled the possibilities of customised tab-completion in
bash.

Here is a first try at having useful tab-completion for grass. The goal is to
have mapname, layername, filename, columname completion and so on. For now,
just becoming acquainted with readline within bash, I have the following:

- tab-completion for commands works as always
- after a command, you have tab-completion for options and flags
- within options, you have tab-completion for fixed value sets

I also played along but still didn't integrate layername and database
columnname completion.

Please give this a try and comment on it. I'd like to know whether it might be
useful enough to complete (sic) it.

To enable the current features, source this file from bash, e.g. '. filename'.
If your shell isn't a current enough version of bash, the script will do nothing.

More to follow, but "release early" as the saying goes.

Oh, and so many thanks to whomever came up with --interface-description in
parser.c

Good night.

-- Daniel Calvelo Aros

(attachments)

grass_rlcompleter-v0.sh (2.68 KB)

*,

Second installment of readline/bash completion for grass. Now it will also
complete raster, vector, etc. names. And filenames too, where appropriate.

The version I sent yesterday had a bug preventing even activation. Sorry.

To use this, from the grass prompt:

$ . grass_rlcompleter-v1.sh

Then try, e.g.

$ v.in.a<tab> <tab> i<tab>

Or, assuming d.vect.thematic is installed in $GISBASE/scripts

$ d.vect.thematic t<tab>a<tab> th<tab>c<tab>i<tab> map=<tab>

That should get you

$ d.vect.thematic type=area themecalc=interval map=<choose from your list of
available (new) vectors>

Any feedback (including insults) is welcome.

Daniel.

-- Daniel Calvelo Aros

---------- Original Message -----------
From: "Daniel Calvelo Aros" <dcalvelo@minag.gob.pe>
To: grass5@grass.itc.it
Sent: Thu, 26 May 2005 04:45:21 -0500
Subject: [GRASS5] Readline completion for grass

Hi all,

With some recent threads about immediate availability of layers list,
column names and so on, I recalled the possibilities of customised
tab-completion in bash.

Here is a first try at having useful tab-completion for grass. The
goal is to have mapname, layername, filename, columname completion
and so on. For now, just becoming acquainted with readline within
bash, I have the following:

- tab-completion for commands works as always
- after a command, you have tab-completion for options and flags
- within options, you have tab-completion for fixed value sets

I also played along but still didn't integrate layername and database
columnname completion.

Please give this a try and comment on it. I'd like to know whether
it might be useful enough to complete (sic) it.

To enable the current features, source this file from bash, e.g. '. filename'.
If your shell isn't a current enough version of bash, the script
will do nothing.

More to follow, but "release early" as the saying goes.

Oh, and so many thanks to whomever came up with --interface-
description in parser.c

Good night.

-- Daniel Calvelo Aros

------- End of Original Message -------

(attachments)

grass_rlcompleter-v1.sh (3.41 KB)

> With some recent threads about immediate availability of layers
> list, column names and so on, I recalled the possibilities of
> customised tab-completion in bash.

Were you aware of the existing implementation?

look for "GRASS shell extension" at

  http://grass.ibiblio.org/download/addons.php

note the link is 404 not-found, so not much use to anyone. Maybe someone
has an old copy though? This will surely be pre-GRASS 6 though so yours
will be more up to date, but maybe it could help you.

Once you are happy with it, it can be added to the Add-Ons page in the
wiki. http://grass.gdf-hannover.de/twiki/bin/view/GRASS

regards, (& thanks)
Hamish

From: Hamish <hamish_nospam@yahoo.com>
Sent: Fri, 27 May 2005 09:54:12 +1200

Were you aware of the existing implementation?

No.

look for "GRASS shell extension" at

  http://grass.ibiblio.org/download/addons.php

note the link is 404 not-found, so not much use to anyone. Maybe someone
has an old copy though? This will surely be pre-GRASS 6 though so yours
will be more up to date, but maybe it could help you.

Certainly it could.

Radim, you seem to have got circa 2002; is it still around? It didn't made it
to the source distribution, and Alexandre Sorokine (the original author) is
out of the web currently, it seems.

Once you are happy with it, it can be added to the Add-Ons page in
the wiki. http://grass.gdf-hannover.de/twiki/bin/view/GRASS

Ok.

Daniel Calvelo Aros wrote:

From: Hamish <hamish_nospam@yahoo.com>
Sent: Fri, 27 May 2005 09:54:12 +1200

Were you aware of the existing implementation?

No.

look for "GRASS shell extension" at

http://grass.ibiblio.org/download/addons.php

note the link is 404 not-found, so not much use to anyone. Maybe someone
has an old copy though? This will surely be pre-GRASS 6 though so yours
will be more up to date, but maybe it could help you.

Certainly it could.

Radim, you seem to have got circa 2002; is it still around? It didn't made it
to the source distribution, and Alexandre Sorokine (the original author) is
out of the web currently, it seems.

I have put it here:

http://mpa.itc.it/radim/grass-complete-sorokine/

I am not sure if this is his last version.

Radim

Once you are happy with it, it can be added to the Add-Ons page in the wiki. http://grass.gdf-hannover.de/twiki/bin/view/GRASS

Ok.

_______________________________________________
grass5 mailing list
grass5@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass5