Intelligent start of default editor from Python CLI program?

The answers to this question did not get into the core of the problem. In CLI-based Python, I want the user to be able to edit the file and then return to the program. Before returning, I want them to be able to undo their changes. This should look like a commit commit function in Subversion.

What are the current best practices for this type of task?

+5
source share
2 answers

You can try looking at sources in Mercurial written in Python.

os.environ HGEDITOR, VISUAL EDITOR, vi. os.system , tempfile.mkstemp. , . , , .

, Mercurial , ui.py util.py.

+10

Subversion $EDITOR, , . , $EDITOR , unixy . - Windows (cmd /c start tempfile.txt) Mac OS X (open tempfile.txt).

, , .

"" , . , , . , Subversion.

+2

All Articles