diff --git a/DOCS.md b/DOCS.md index 9cf16df75..eb6f40df4 100644 --- a/DOCS.md +++ b/DOCS.md @@ -123,10 +123,10 @@ depth: 1 #### Usage ``` -coconut [-h] [--and source [dest ...]] [-v] [-t version] [-i] [-p] [-a] [-l] [-k] [-w] - [-r] [-n] [-d] [-q] [-s] [--no-tco] [--no-wrap-types] [-c code] [-j processes] - [-f] [--minify] [--jupyter ...] [--mypy ...] [--argv ...] [--tutorial] - [--docs] [--style name] [--history-file path] [--vi-mode] +coconut [-h] [--and source [dest ...]] [-v] [-t version] [-i] [-p] [-a] [-l] + [--no-line-numbers] [-k] [-w] [-r] [-n] [-d] [-q] [-s] [--no-tco] + [--no-wrap-types] [-c code] [-j processes] [-f] [--minify] [--jupyter ...] + [--mypy ...] [--argv ...] [--tutorial] [--docs] [--style name] [--vi-mode] [--recursion-limit limit] [--stack-size kbs] [--site-install] [--site-uninstall] [--verbose] [--trace] [--profile] [source] [dest] @@ -196,8 +196,6 @@ dest destination directory for compiled files (defaults to --style name set Pygments syntax highlighting style (or 'list' to list styles) (defaults to COCONUT_STYLE environment variable if it exists, otherwise 'default') ---history-file path set history file (or '' for no file) (can be modified by setting - COCONUT_HOME environment variable) --vi-mode, --vimode enable vi mode in the interpreter (currently set to False) (can be modified by setting COCONUT_VI_MODE environment variable) --recursion-limit limit, --recursionlimit limit diff --git a/coconut/command/cli.py b/coconut/command/cli.py index 5087e52d0..0281513b0 100644 --- a/coconut/command/cli.py +++ b/coconut/command/cli.py @@ -31,8 +31,6 @@ default_style, vi_mode_env_var, prompt_vi_mode, - prompt_histfile, - home_env_var, py_version_str, default_jobs, ) @@ -245,13 +243,6 @@ + style_env_var + " environment variable if it exists, otherwise '" + default_style + "')", ) -arguments.add_argument( - "--history-file", - metavar="path", - type=str, - help="set history file (or '' for no file) (currently set to " + ascii(prompt_histfile) + ") (can be modified by setting " + home_env_var + " environment variable)", -) - arguments.add_argument( "--vi-mode", "--vimode", action="store_true", diff --git a/coconut/command/command.py b/coconut/command/command.py index fee072a41..58acb6db0 100644 --- a/coconut/command/command.py +++ b/coconut/command/command.py @@ -278,8 +278,6 @@ def execute_args(self, args, interact=True, original_args=None): self.prompt.vi_mode = args.vi_mode if args.style is not None: self.prompt.set_style(args.style) - if args.history_file is not None: - self.prompt.set_history_file(args.history_file) if args.argv is not None: self.argv_args = list(args.argv) diff --git a/coconut/constants.py b/coconut/constants.py index 38f1c671d..c12c461ea 100644 --- a/coconut/constants.py +++ b/coconut/constants.py @@ -50,6 +50,11 @@ def get_bool_env_var(env_var, default=False): return default +def get_path_env_var(env_var, default): + """Get a path from an environment variable.""" + return fixpath(os.getenv(env_var, default)) + + # ----------------------------------------------------------------------------------------------------------------------- # VERSION CONSTANTS: # ----------------------------------------------------------------------------------------------------------------------- @@ -604,14 +609,17 @@ def get_bool_env_var(env_var, default=False): force_verbose_logger = get_bool_env_var("COCONUT_FORCE_VERBOSE", False) -coconut_home = fixpath(os.getenv(home_env_var, "~")) +coconut_home = get_path_env_var(home_env_var, "~") use_color = get_bool_env_var("COCONUT_USE_COLOR", None) error_color_code = "31" log_color_code = "93" default_style = "default" -prompt_histfile = os.path.join(coconut_home, ".coconut_history") +prompt_histfile = get_path_env_var( + "COCONUT_HISTORY_FILE", + os.path.join(coconut_home, ".coconut_history"), +) prompt_multiline = False prompt_vi_mode = get_bool_env_var(vi_mode_env_var, False) prompt_wrap_lines = True diff --git a/coconut/root.py b/coconut/root.py index ff0868cab..067ee2734 100644 --- a/coconut/root.py +++ b/coconut/root.py @@ -26,7 +26,7 @@ VERSION = "3.0.3" VERSION_NAME = None # False for release, int >= 1 for develop -DEVELOP = 1 +DEVELOP = 2 ALPHA = False # for pre releases rather than post releases assert DEVELOP is False or DEVELOP >= 1, "DEVELOP must be False or an int >= 1"