[GRASS5] New feature: GRASS-specific completion for bash

Radim Blazek blazek at itc.it
Mon May 27 05:05:08 EDT 2002


On Friday 24 May 2002 06:27 pm, Alexandre Sorokine wrote:

> > 3) My wish is to have completion for map names - is it possible?
>
> Yes, current verion completes on map names, mapsets, monitors and
> colors. In order to get a list of completion for map names your cursor
> should be placed on the position just after the equal sign.

Colors, monitors work, map names, mapsets (dynamic lists) do not.
I think that problem will be in 
g_list() # argument is a GRASS data type
{
    local IFS=$''
    echo `g.list $1 | perl -pe 's/^-+$//o; s/^[^:]+:$//o; s/\s+/\n/go'`
}

echo `echo "ab cd" | perl -pe 's/^-+$//o; s/^[^:]+:$//o; s/\s+/\n/go'`
works (for ab, cd maps). Also g.list works there:

echo `g.list $1 | perl -pe 's/^-+$//o; s/^[^:]+:$//o; s/\s+/\n/go'` > err.log

prints to err.log:
GRASS:~/GRASS/bashCompletion/complete > cat err.log
 
 
coastline_chch
coastline_dun
coastline_waitaki
pok

i.e. 2 empty rows + my maps.

It seems that it doesn't like empty rows because
g.list vect | sed 's/^-*$//' | sed 's/.*:$//' | tr '\012' ' ' 
works.


Radim



More information about the grass-dev mailing list