Save command line history and provide a command line completer for python.
Project description
pyCmdlineHistory
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Save command line history and provide a command line completer for python.
Original code is from ActiveState Code » Recipes 2006.06.29 by Sunjoong LEE. ActiveState content is published under CC BY-SA 3.0.
Usage
Insert the line,
import sys
import subprocess
try:
import berhoel.cmd_line_history
except ImportError:
# checking if python is running under virtualenv of venv
is_venv = (
# This handles PEP 405 compliant virtual environments.
(sys.prefix != getattr(sys, "base_prefix", sys.prefix))
or
# This handles virtual environments created with pypa's virtualenv.
hasattr(sys, "real_prefix")
)
subprocess.check_call(
[sys.executable, "-m", "pip", "install"]
+ ([] if is_venv else ["--user"])
+ ["pyCmdlineHistory",]
)
to "~/.pystartup" file, and set an environment variable to point to it:
export PYTHONSTARTUP=${HOME}/.pystartup
in bash.
This will locally install the module for each python you are calling.
References
- Guido van Rossum. Python Tutorial. Python Sfotware Foundation, 2005. 86
- Jian Ding Chen. Indentable rlcompleter. Python Cookbook Recipe 496812
- Guido van Rossum. rlcompleter.py. Python Sfotware Foundation, 2005
2006.06.29 Sunjoong LEE sunjoong@gmail.com
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyCmdlineHistory-1.1.3.tar.gz
(11.4 kB
view hashes)
Built Distribution
Close
Hashes for pyCmdlineHistory-1.1.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff515336600aa09462a382a98d88c35156de387d4545a6e44b31e00a14cf27f9 |
|
MD5 | 420e9819d25dff08bb2369cc21d8b2cc |
|
BLAKE2b-256 | 810db944984ffe1db75e35b643da4f17c42c15b42c4d1960f32e148fadde4430 |