Skip to content

Commit

Permalink
Remove --history-file
Browse files Browse the repository at this point in the history
Resolves   #778.
  • Loading branch information
evhub committed Jul 29, 2023
1 parent ee3e4fe commit 200dede
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 20 deletions.
10 changes: 4 additions & 6 deletions DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand Down
9 changes: 0 additions & 9 deletions coconut/command/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
default_style,
vi_mode_env_var,
prompt_vi_mode,
prompt_histfile,
home_env_var,
py_version_str,
default_jobs,
)
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 0 additions & 2 deletions coconut/command/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
12 changes: 10 additions & 2 deletions coconut/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
# -----------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion coconut/root.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 200dede

Please sign in to comment.