X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=TODO.txt;h=968d232778ed789d5fee0c274b54b58497bc41b9;hb=27fbfad09ece8c5e4fe7be9079172ee1b75de769;hp=2e8fe547a2dff5bdd9e33234c37d131c06f32966;hpb=6f32a68393e01b4179592b9f48255179e8ad55f7;p=libcmdline.git diff --git a/TODO.txt b/TODO.txt index 2e8fe54..968d232 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,7 +1,95 @@ -- token file/path - libevent example - better example than calculator - check all XXX in code - set prompt example - too much possible completion -- token string entre guillemets ? +- les help() des tokens (string par ex) ne retournent pas "faux" en cas d'erreur +- on pourrait virer la valeur de retour du start() en reorganisant + cmdline_parse() et cmdline_help() +- genconf: completion des xpath // +- supprimer tous les basic_char_loop() +- possibilité de retourner une erreur dans le parsing (file not found, ...) +- parse(): res ne peut pas etre null pour ipaddr ? +- kill word (alt-bkspace) pourrait s'arreter aux slashs +- rdline: use fopencookies pour le printf ? + +--------------- + +buf->linebuf + +- rdline: API peut rester comme ca + doit pouvoir etre utiisé seule + il fuat un example + +- parse: + doit aussi pouvoir etre utilisé seule + il faut virer les references a cmdline/rdline + +/* opaque is given to the token callback func */ +int cmdline_parse(parse_ctx, const char *buf, void *opaque); + + +cmdline_complete_init(cmplt_ctx) + +/** + * complete() must be called with an initialized context + * with *state==-1 (just display choices), then called until it + * returns CMDLINE_PARSE_COMPLETED_BUFFER or + * CMDLINE_PARSE_COMPLETE_FINISHED. + * + * It returns < 0 on error. + * + * Else it returns: + * - CMDLINE_PARSE_COMPLETED_BUFFER on completion (one possible + * choice). In this case, the chars are appended in dst buffer. + * - CMDLINE_PARSE_COMPLETE_AGAIN if there is several possible + * choices. In this case, you must call the function again with + * the same context + * - CMDLINE_PARSE_COMPLETE_FINISHED when the iteration is + * finished. The dst is not valid for this last call. + * + * The returned dst buf ends with \0. + */ +int cmdline_complete(parse_ctx, const char *buf, cmplt_ctx, + char *dst, unsigned int size); + + +- cmdline est un assemblage de rdline et parse + permet de parser des fichiers, de faire un prompt sur stdin, network, unix + +tests unitaires + + +-------------- + +completions possibles + +toto +toti +titi +coin + +"" -> all (help) +complete = "toto", complete_len = 4 +complete = "tot", complete_len = 3 +complete = "t", complete_len = 1 +complete = "", complete_len = 0 +n_completions = 4 + + +"t" -> "toto" "toti" "titi" (help) +toklen = 1 +complete = "toto", complete_len = 4 +complete = "tot", complete_len = 3 +complete = "t", complete_len = 1 +n_completions = 3 + +"to" -> "tot" (complete, not finished) +toklen = 2 +complete = "toto", complete_len = 4 +complete = "tot", complete_len = 3 +n_completions = 2 + +"ti" -> "titi " (complete, finished) +n_completions = 1 +