| 1 | # Incompatibilities |
| 2 | |
| 3 | `cmd2` strives to be drop-in compatible with [cmd][cmd], however there are a few incompatibilities. |
| 4 | |
| 5 | ## Cmd.emptyline() |
| 6 | |
| 7 | The [Cmd.emptyline()](https://docs.python.org/3/library/cmd.html#cmd.Cmd.emptyline) function is |
| 8 | called when an empty line is entered in response to the prompt. By default, in `cmd` if this method |
| 9 | is not overridden, it repeats and executes the last nonempty command entered. However, no end user |
| 10 | we have encountered views this as expected or desirable default behavior. `cmd2` completely ignores |
| 11 | empty lines and the base class `cmd.emptyline()` method never gets called and thus the empty line |
| 12 | behavior cannot be overridden. |
| 13 | |
| 14 | ## Cmd.identchars |
| 15 | |
| 16 | In [cmd][cmd], the [Cmd.identchars](https://docs.python.org/3/library/cmd.html#cmd.Cmd.identchars) |
| 17 | attribute contains the string of characters accepted for command names. [cmd][cmd] uses those |
| 18 | characters to split the first "word" of the input, without requiring the user to type a space. For |
| 19 | example, if `identchars` contained a string of all alphabetic characters, the user could enter a |
| 20 | command like `L20` and it would be interpreted as the command `L` with the first argument of `20`. |
| 21 | |
| 22 | Since version 0.9.0, `cmd2` has ignored `identchars`; the parsing logic in `cmd2` splits the command |
| 23 | and arguments on whitespace. We opted for this breaking change because while [cmd][cmd] supports |
| 24 | unicode, using non-ascii unicode characters in command names while simultaneously using `identchars` |
| 25 | functionality can be somewhat painful. Requiring white space to delimit arguments also ensures |
| 26 | reliable operation of many other useful `cmd2` features, including |
| 27 | [Tab Completion](../features/completion.md) and |
| 28 | [Shortcuts, Aliases, and Macros](../features/shortcuts_aliases_macros.md). |
| 29 | |
| 30 | If you really need this functionality in your app, you can add it back in by writing a |
| 31 | [Postparsing Hook](../features/hooks.md#postparsing-hooks). |
| 32 | |
| 33 | ## Cmd.cmdqueue |
| 34 | |
| 35 | In [cmd][cmd], the [Cmd.cmdqueue](https://docs.python.org/3/library/cmd.html#cmd.Cmd.cmdqueue) |
| 36 | attribute contains a list of queued input lines. The cmdqueue list is checked in `cmdloop()` when |
| 37 | new input is needed; if it is nonempty, its elements will be processed in order, as if entered at |
| 38 | the prompt. |
| 39 | |
| 40 | Since version 0.9.13 `cmd2` has removed support for `Cmd.cmdqueue`. Because `cmd2` supports running |
| 41 | commands via the main `cmdloop()`, text scripts, Python scripts, and history replays, the only way |
| 42 | to preserve consistent behavior across these methods was to eliminate the command queue. |
| 43 | Additionally, reasoning about application behavior is much easier without this queue present. |
| 44 | |
| 45 | [cmd]: https://docs.python.org/3/library/cmd |