Welcome to the Linux Foundation Forum!

Making it Easier to Undo Commands

Hello. I had some ideas that I would like to share with the Linux Community pertaining to making it easier to undo commands.

In the future, end-users might choose to engage in man-machine dialogues with AI systems to perform shell tasks, to execute commands, to generate and execute shell scripts on-the-fly, to open software applications, and to interact with these applications (see also: OpenInterpreter, ShellE).

What if a mistake occurred? How might end-users easily undo their previous command?

For discussion, some possibilities are indicated:

  1. Some commands could be accompanied by secondary commands prefixed with "undo-" or "undo_".
  2. Some commands' executables could have a second entry point. That is, as there is the main function, there could also be an undo function. The undo function would be called when the command was expected to undo the prior call to main and it would be expected to be provided with the same command-line arguments as the previous call to its accompanying main function.

For both of these possibilities, an "undo-command" should be able to, first, determine whether that command which it undoes had previously been run.

What do you think about these possibilities? Do any other possibilities come to mind?

Comments

  • Some more ideas and uses for multiple entry points in executables include:

    1. do (the main entry point, performs the action)
    2. undo (undoes the action)
    3. can do (return whether a system can presently do the action with the provided arguments without doing)
    4. can undo (return whether a system can presently undo the action, having done it, without undoing it)
    5. would be able to undo (return whether a system would be able to undo the action if it were to do it, without doing or undoing it)

    In theory, secondary entry points could be executed from the command line using corresponding special "meta-commands". For example,

    > undo cmd arg1 arg2

    would execute into the undo entry point in the cmd executable, passing it the provided arguments.

    Uses of the can do entry point would include easily validating command-line syntax and arguments or, for some commands, performing more complex pre-flight checklists.

    Any thoughts on these ideas?

Categories

Upcoming Training