Re: command aliases and tool/command wiki page

Posted by ravas on
URL: https://forum.librecad.org/command-aliases-and-tool-command-wiki-page-tp5711297p5711370.html

I'm updating http://wiki.librecad.org/index.php/Commands_and_tools_-_using_the_command_line
But I'm confused by the inconsistency of rs_commands.cpp.
I could help out with cleaning it up if I could see a logical pattern.

Compare DrawLineRectangle and ZoomRedraw:

    cmdTranslation.insert("rectangle", tr("rectangle"));
    mainCommands.insert(tr("rectangle"), RS2::ActionDrawLineRectangle);
    cmdTranslation.insert("rect", tr("rect"));
    shortCommands.insert(tr("rectang"), RS2::ActionDrawLineRectangle);
    shortCommands.insert(tr("rect"), RS2::ActionDrawLineRectangle);
    shortCommands.insert(tr("rec"), RS2::ActionDrawLineRectangle);

    // zoom:
    cmdTranslation.insert("regen", tr("regen"));
    cmdTranslation.insert("redraw", tr("redraw"));
    mainCommands.insert(tr("regen"), RS2::ActionZoomRedraw);
    mainCommands.insert(tr("redraw"), RS2::ActionZoomRedraw);
    shortCommands.insert(tr("rg", "zoom - redraw"), RS2::ActionZoomRedraw);

    cmdTranslation.insert("zr", tr("zr"));
    shortCommands.insert(tr("zr", "zoom - redraw"), RS2::ActionZoomRedraw);

Why cmdTranslation for only rect and rectangle (and not for rec)?

Why mainCommands for regen and redraw?
Doesn't it make sense to have only one main command (thinking of the alias file)?

Why two aliases in shortCommands.insert(tr("rg", "zoom - redraw")?