mbrubeck / compleat

Generate command-line completions using a simple DSL.

Home Page:http://limpet.net/mbrubeck/2009/10/30/compleat.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Completion for `ls`

NV opened this issue · comments

How ls.usage should look like?

$ man ls
SYNOPSIS
    ls [-ABCFGHLPRTWZabcdefghiklmnopqrstuwx1] [file ...]

$ echo "ls [-ABCFGHLPRTWZabcdefghiklmnopqrstuwx1] [file ...]" > ~/.compleat/ls.usage
$ exec bash
$ ls -↹
$ ls -ABCFGHLPRTWZabcdefghiklmnopqrstuwx1

( is a tab key)

This is not what I'm expecting. Ok, another try:

$ echo "ls [-(A|B|C|F|G|H|L|P|R|T|W|Z|a|b|c|d|e|f|g|h|i|k|l|m|n|o|p|q|r|s|t|u|w|x|1)] [<file> ...]" > ~/.compleat/ls.usage
$ exec bash
$ ls ↹
$ ls - 

Instead of file listing - added.

$ ls - ↹
1   B   F   H   P   T   Z   b   d   f   h   k   m   o   q   s   u   x   
A   C   G   L   R   W   a   c   e   g   i   l   n   p   r   t   w

Space after - should not exist.

BTW, the idea of compleat is really elegant. I like it.

Thanks for the report! Strings in Compleat usage files right now are always treated as whole words/tokens. There's no way yet to do regexp-style patterns within a word. So unfortunately you need to do something this:

ls [-A|-B|-C|-F] ...

I'll see if I can solve this, either in a general way, or with a specific syntax for short (single-letter) options.