无论如何在Tcsh中编写类似这样的东西,当你按Tab键时参数会被改变。类似于在iOS / Android上它如何自动完成“在我的路上!”的“omw”。
注意:█是文本光标位置
> script.py imgPath█
* [按Tab键] *
> script.py this/example/file/path/LONG_IMAGE_NAME_█
然后从那里,因为我有完整的路径,我可以使用选项卡执行正常的文件名自动完成。例如,如果我有一个名为LONG_IMAGE_NAME_SCREENSHOT_635.jpg
的文件,我可以在agrument的末尾添加S
并按正常方式点击标签:
> script.py this/example/file/path/LONG_IMAGE_NAME_S█
* [按Tab键] *
> script.py this/example/file/path/LONG_IMAGE_NAME_SCREENSHOT_635.jpg█
文件链接不适用于此,因为它不添加文件名的开头,别名因文件名也不起作用。
来自tcsh(1)
:
> set local = /usr/local
> ls $lo[tab]
> ls $local/[^D]
bin/ etc/ lib/ man/ src/
> ls $local/
Note that variables can also be expanded explicitly with the expand-
variables editor command.
因此,如示例所示,您可以设置imgPath
变量。
expand-variables
默认映射到^X$
(按^X
,然后$
),并将$imgPath
扩展到它拥有的任何值。
据我所知,没有办法在tcsh中的tab上扩展$imgPath
。