| 1 | # Minimum Required Changes |
| 2 | |
| 3 | [cmd2.Cmd][] provides all of the same public methods and fields of |
| 4 | [cmd.Cmd](https://docs.python.org/3/library/cmd.html#cmd.Cmd) from the standard library other than |
| 5 | `Cmd.emptyline` (`cmd2` never calls this method). Most apps based on the standard library can be |
| 6 | migrated to `cmd2` in just a couple of minutes. |
| 7 | |
| 8 | ## Import and Inheritance |
| 9 | |
| 10 | You need to change your import from this: |
| 11 | |
| 12 | ```py |
| 13 | import cmd |
| 14 | ``` |
| 15 | |
| 16 | to this: |
| 17 | |
| 18 | ```py |
| 19 | import cmd2 |
| 20 | ``` |
| 21 | |
| 22 | Then you need to change your class definition from: |
| 23 | |
| 24 | ```py |
| 25 | class CmdLineApp(cmd.Cmd): |
| 26 | ``` |
| 27 | |
| 28 | to: |
| 29 | |
| 30 | ```py |
| 31 | class CmdLineApp(cmd2.Cmd): |
| 32 | ``` |
| 33 | |
| 34 | ## Exiting |
| 35 | |
| 36 | Have a look at the commands you created to exit your application. You probably have one called |
| 37 | `exit` and maybe a similar one called `quit`. You also might have implemented a `do_EOF()` method so |
| 38 | your program exits like many operating system shells. If all these commands do is quit the |
| 39 | application, you may be able to remove them. See [Exiting](../features/misc.md#exiting). |
| 40 | |
| 41 | ## Distribution |
| 42 | |
| 43 | If you are distributing your application, you'll also need to ensure that `cmd2` is properly |
| 44 | installed. You will need to add the following dependency to your `pyproject.toml` or `setup.py`: |
| 45 | |
| 46 | 'cmd2>=3,<4' |
| 47 | |
| 48 | See [Integrate cmd2 Into Your Project](../overview/integrating.md) for more details. |