0

I am working with a Makefile for conversion of documents.
To specify which document to convert, I have to give folder names in 2 make-variables:
NAME and DATE.
The directory structure is /data/$(NAME)/$(DATE)

NAME may contain numbers and characters.
DATE follows this format: YYYYMMDD_XXXXXXXX where X is a hex-char.
I want to make complete suggest the NAME and DATE variables in tcsh (mandatory use on site), because it is annoying to enter those random X-chars.

I ended up having the following to suggest me the NAME variable: 'c@{NAME}=@D:/data@' \ 'C/N*/(NAME=)/'

This works as expected as long as I do unset addsuffix.
make N[TAB] » make NAME=[TAB] » make NAME=10001.1
If addsuffix is set, the cursor will be after the trailing whitespace in make NAME=.
For complete a new word starts, so it does not suggest me the directories for NAME then. If I go to NAME= then, it also adds the trailing / to folder name, which is not needed.

Is there a way to disable this behaviour for these completions?
tcsh.org states:

addsuffix If set, filename completion adds `/' to the end of directories and a space to the end of normal files when they are matched exactly. Set by default.

Obviously I want to keep the behaviour (as set by the user) for other completion.

dbc
  • 104,963
  • 20
  • 228
  • 340
sbulka
  • 21
  • 1
  • 4

1 Answers1

0

The [suffix] is what I want to be void.

from documentation:

complete [command [word/pattern/list[:select]/[[suffix]/] ...]]

So I end up with complete make \ 'c@NAME=@D:/data/@' \ 'c@DATE=@`echo $COMMAND_LINE | sed -f /data/sandbox/sbulka/tmp/sed-tmp.sed | xargs ls`@' \ 'C/N*/(NAME=)//' \ 'n/NAME=/(DATE=)//'

The sed is in a file so I don't have to bother quoting. Looks like this: s/^.*NAME=\([^ ]*\).*$/\/data\/\1/

sbulka
  • 21
  • 1
  • 4