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,
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.2.tar.gz
(11.4 kB
view hashes)
Built Distribution
Close
Hashes for pyCmdlineHistory-1.1.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1678c5d03a67885d2175d45f438c2c7b66ff4148bd6aa406ba82b6963672f1f3 |
|
MD5 | ec202d42296362dc9cd592c7cf7b595e |
|
BLAKE2b-256 | 14d6059ac7161bf2e8f33a8bfee3fd4ccf0dc445b435cd72fe413fee08e330fe |