Hi Rasmus, On Tue, 2 Jun 2020 at 03:13, Rasmus Villemoes <rasmus.villem...@prevas.dk> wrote: > > On 31/05/2020 16.07, Simon Glass wrote: > > Hi Rasmus, > > > > On Tue, 19 May 2020 at 16:01, Rasmus Villemoes > > <rasmus.villem...@prevas.dk> wrote: > >>
[..] > >> +int do_rtc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) > >> +{ > >> + static int curr_rtc = 0; > >> + struct udevice *dev; > >> + int ret, idx; > >> + > >> + if (argc < 2) > >> + return CMD_RET_USAGE; > >> + > >> + argc--; > >> + argv++; > >> + > >> + if (!strcmp(argv[0], "list")) { > > > > It is comment in U-Boot to just check the letters that are needed. So > > here you could do (*argv[0] == 'l') > > Yes, and I consider that an anti-pattern. It makes it impossible to > later introduce another (sub)command which starts with a > previously-unique prefix. Now, if that "just type a unique prefix" > wasn't official, so scripts were always supposed to use the full names, > it wouldn't be that big a problem (scripts written for later versions of > U-Boot, or U-Boots configured with more (sub)commands, could still fail > silently if used on an earlier U-Boot or one with fewer (sub)commands > instead of producing a "usage" error message), but > https://www.denx.de/wiki/view/DULG/UBootCommandLineInterface explicitly > mentions that as a feature (and says h can be used for help, which it > can't when the hash command is built in, perfectly exemplifying what I'm > talking about). Hah funny. Using an abbreviation is only possible if no other command starts with the same leters. It is certainly very risky to use abbreviations in scripts. I would not recommend it. Abbreviations are for interactive use. If you have auto-completion on you can use tab. But here we are talking about a sub-command, which is a bit more controlled, in that it doesn't depend on what other commands the user enables. Anyway, it's up to you what you want to do here. Regards, Simon