Auto-expanding CLI command invocations hinders forward compatibility

When typing nanoc co, Nanoc will infer that to mean the same as nanoc compile. While this looks convenient, it prevents adding a command that nanoc co could complete to.

For example: nanoc co works properly out of the box:

% nanoc co
Loading site… done
Compiling site…

Site compiled in 0.37s.

%

However, if I were to add a new command called correct (which I can do because Nanoc loads commands/ subdirectory), then nanoc co stops working:

% nanoc co
nanoc: 'c' is ambiguous:
  compile correct

%

To keep forwards compatibility, don’t auto-expand CLI command invocations, and instead exit with a “did you mean” error. For example:

% nanoc co
nanoc: 'co' is not a known command.
  did you mean:
    compile

%

It’s worth hardcoding common shorthands: for example, co could always be short for compile, even if a correct command is added afterwards:

% nanoc co
Loading site… done
Compiling site…

Site compiled in 0.37s.

% nanoc correct
Correcting all the things… ok

% 
Note last edited November 2023.