Mercurial > octave
changeset 32678:49d6ecd07a76
Rename command-line options for handling configuration files.
Use --no-init-all as alias for --norc. Use --no-init-user for --no-init-file.
Use --no-init-site for --no-site-file.
* NEWS.10.md: Announce changes.
* basics.txi: Document three new options in manual.
* interpreter.h (interpreter::m_read_user_files): New member variable.
* interpreter.h (interpreter::read_user_files): New function.
* interpreter.h (interpreter::read_init_files): Add OCTAVE_DEPRECATED tag.
* interpreter.cc (interpreter::interpreter): Use m_read_user_files variable.
* interpreter.cc (execute_startup_files): Rename local variable to "read_user_files".
Use m_read_user_files variable.
* octave.h (read_init_files): Add OCTAVE_DEPRECATED tag.
* octave.h (read_user_files): New function.
* octave.h (m_read_user_files): New member variable.
* octave.cc (cmdline_options): Use m_read_user_files variable.
* octave.cc (as_octave_value): Use init_trace() function. Provide alias
verbose in struct.
* options.h: Rename #defines to "NO_INIT_USER_OPTION", "NO_INIT_SITE_OPTION".
* options.h (long_opts): Add option "--no-init-all" as alias for '-'f.
Add "--no-init-file", "--no-init-site" options. Add comment about
--no-init-file and --no-site-file being deprecated.
* usage.h (usage_string, octave_print_verbose_usage_and_exit): Add reference
to --no-init-all, --no-init-user, --no-init-site. Remove standalone --norc
and remove --no-site-file, no-init-file.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 02 Jan 2024 16:12:16 -0800 |
parents | 03dcf031fbf3 |
children | adc94ac2fd35 |
files | doc/interpreter/basics.txi etc/NEWS.10.md libinterp/corefcn/interpreter.cc libinterp/octave.cc libinterp/octave.h libinterp/options.h libinterp/usage.h |
diffstat | 7 files changed, 66 insertions(+), 43 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/interpreter/basics.txi Tue Jan 02 13:42:37 2024 -0800 +++ b/doc/interpreter/basics.txi Tue Jan 02 16:12:16 2024 -0800 @@ -174,26 +174,37 @@ @cindex @sortas{options, Octave command -H} @ @ @code{-H} Disable recording of command-line history. -@item --no-init-file -@cindex @sortas{options, Octave command --no-init-file} @ @ @code{--no-init-file} -@cindex @sortas{octaverc ~/.octaverc} @code{~/.octaverc} -@cindex @sortas{octaverc .octaverc} @code{.octaverc} -Don't read the initialization files @file{~/.octaverc} and @file{.octaverc}. +@item --no-init-all +@itemx --norc +@itemx -f +@cindex @sortas{options, Octave command --no-init-all} @ @ @code{--no-init-all} +@cindex @sortas{options, Octave command --norc} @ @ @code{--norc} +@cindex @sortas{options, Octave command -f} @ @ @code{-f} +Don't read any of the system or user initialization files at startup. +This is equivalent to using both of the options @option{--no-site-file} +and @option{--no-init-user}. @item --no-init-path @cindex @sortas{options, Octave command --no-init-path} @ @ @code{--no-init-path} Don't initialize the search path for function files to include default locations. +@item --no-init-site +@cindex @sortas{options, Octave command --no-init-site} @ @ @code{--no-init-site} +@cindex site startup file +Don't read the site-wide @file{octaverc} initialization files. + +@item --no-init-user +@cindex @sortas{options, Octave command --no-init-user} @ @ @code{--no-init-user} +@cindex @sortas{octaverc ~/.octaverc} @code{~/.octaverc} +@cindex @sortas{octaverc .octaverc} @code{.octaverc} +Don't read the user initialization files @file{~/.octaverc} and +@file{.octaverc}. + @item --no-line-editing @cindex @sortas{options, Octave command --no-line-editing} @ @ @code{--no-line-editing} Disable command-line editing. -@item --no-site-file -@cindex @sortas{options, Octave command --no-site-file} @ @ @code{--no-site-file} -@cindex site startup file -Don't read the site-wide @file{octaverc} initialization files. - @item --no-window-system @itemx -W @cindex @sortas{options, Octave command --no-window-system} @ @ @code{--no-window-system} @@ -201,14 +212,6 @@ Disable use of a windowing system including graphics. This forces a strictly terminal-only environment. -@item --norc -@itemx -f -@cindex @sortas{options, Octave command --norc} @ @ @code{--norc} -@cindex @sortas{options, Octave command -f} @ @ @code{-f} -Don't read any of the system or user initialization files at startup. -This is equivalent to using both of the options @option{--no-init-file} -and @option{--no-site-file}. - @item --path @var{path} @itemx -p @var{path} @cindex @sortas{options, Octave command --path} @ @ @code{--path @var{path}}
--- a/etc/NEWS.10.md Tue Jan 02 13:42:37 2024 -0800 +++ b/etc/NEWS.10.md Tue Jan 02 16:12:16 2024 -0800 @@ -9,6 +9,12 @@ * `-g` for `--gui` * `-G` for `--no-gui` +- Three long form options have been introduced for clarity. + * `--no-init-user` : Don't read user configuration files ~/.octaverc or + .octaverc files at startup. + * `--no-init-site` : Don't read site-wide configuration files at startup. + * `--no-init-all` : Don't read any configuration files at startup. + ### Graphical User Interface ### Graphics backend
--- a/libinterp/corefcn/interpreter.cc Tue Jan 02 13:42:37 2024 -0800 +++ b/libinterp/corefcn/interpreter.cc Tue Jan 02 16:12:16 2024 -0800 @@ -455,7 +455,7 @@ m_gh_manager (nullptr), m_interactive (false), m_read_site_files (true), - m_read_init_files (m_app_context != nullptr), + m_read_user_files (m_app_context != nullptr), m_init_trace (false), m_traditional (false), m_inhibit_startup_message (false), @@ -1100,7 +1100,7 @@ interpreter::execute_startup_files () { bool read_site_files = m_read_site_files; - bool read_init_files = m_read_init_files; + bool read_user_files = m_read_user_files; bool trace = m_init_trace; bool inhibit_startup_message = m_inhibit_startup_message; @@ -1109,7 +1109,7 @@ const cmdline_options& options = m_app_context->options (); read_site_files = options.read_site_files (); - read_init_files = options.read_init_files (); + read_user_files = options.read_user_files (); trace = options.init_trace (); inhibit_startup_message = options.inhibit_startup_message (); } @@ -1142,7 +1142,7 @@ exit_status = status; } - if (read_init_files) + if (read_user_files) { // Try to execute commands from the Matlab compatible startup.m file // if it exists anywhere in the load path when starting Octave.
--- a/libinterp/octave.cc Tue Jan 02 13:42:37 2024 -0800 +++ b/libinterp/octave.cc Tue Jan 02 16:12:16 2024 -0800 @@ -119,7 +119,7 @@ break; case 'f': - m_read_init_files = false; + m_read_user_files = false; m_read_site_files = false; break; @@ -192,8 +192,8 @@ m_forced_line_editing = m_line_editing = true; break; - case NO_INIT_FILE_OPTION: - m_read_init_files = false; + case NO_INIT_USER_OPTION: + m_read_user_files = false; break; case NO_INIT_PATH_OPTION: @@ -204,7 +204,7 @@ m_line_editing = false; break; - case NO_SITE_FILE_OPTION: + case NO_INIT_SITE_OPTION: m_read_site_files = false; break; @@ -256,7 +256,9 @@ m.assign ("no_window_system", no_window_system ()); m.assign ("persist", persist ()); m.assign ("read_history_file", read_history_file ()); - m.assign ("read_init_files", read_init_files ()); + // FIXME: read_init_files deprecated in Octave 10 in favor of read_user_files + m.assign ("read_init_files", read_user_files ()); + m.assign ("read_user_files", read_user_files ()); m.assign ("read_site_files", read_site_files ()); m.assign ("server", server ()); m.assign ("set_initial_path", set_initial_path ());
--- a/libinterp/octave.h Tue Jan 02 13:42:37 2024 -0800 +++ b/libinterp/octave.h Tue Jan 02 16:12:16 2024 -0800 @@ -67,8 +67,10 @@ bool no_window_system () const { return m_no_window_system; } bool persist () const { return m_persist; } bool read_history_file () const { return m_read_history_file; } - bool read_init_files () const { return m_read_init_files; } bool read_site_files () const { return m_read_site_files; } + bool read_user_files () const { return m_read_user_files; } + OCTAVE_DEPRECATED (10, "cmdline_options::read_init_files is deprecated, use read_user_files") + bool read_init_files () const { return m_read_user_files; } bool server () const { return m_server; } bool set_initial_path () const { return m_set_initial_path; } bool traditional () const { return m_traditional; } @@ -102,8 +104,12 @@ void no_window_system (bool arg) { m_no_window_system = arg; } void persist (bool arg) { m_persist = arg; } void read_history_file (bool arg) { m_read_history_file = arg; } - void read_init_files (bool arg) { m_read_init_files = arg; } + // FIXME: Alias for read_user_files() introduced in Octave 10. + // Remove at some point in the future. void read_site_files (bool arg) { m_read_site_files = arg; } + void read_user_files (bool arg) { m_read_user_files = arg; } + OCTAVE_DEPRECATED (10, "cmdline_options::read_init_files is deprecated, use read_user_files") + void read_init_files (bool arg) { read_user_files (arg); } void server (bool arg) { m_server = arg; } void set_initial_path (bool arg) { m_set_initial_path = arg; } void traditional (bool arg) { m_traditional = arg; } @@ -168,11 +174,11 @@ bool m_read_history_file = true; // TRUE means we read ~/.octaverc and ./.octaverc. - // (--norc; --no-init-file; -f) - bool m_read_init_files = true; + // (--no-init-user; --no-init-file; --norc; -f) + bool m_read_user_files = true; // TRUE means we read the site-wide octaverc files. - // (--norc; --no-site-file; -f) + // (--no-init-site; --no-site-file; --norc; -f) bool m_read_site_files = true; // If TRUE, start the command server.
--- a/libinterp/options.h Tue Jan 02 13:42:37 2024 -0800 +++ b/libinterp/options.h Tue Jan 02 16:12:16 2024 -0800 @@ -46,10 +46,10 @@ #define INFO_PROG_OPTION 7 #define LINE_EDITING_OPTION 8 #define NO_GUI_LIBS_OPTION 9 -#define NO_INIT_FILE_OPTION 10 +#define NO_INIT_USER_OPTION 10 #define NO_INIT_PATH_OPTION 11 #define NO_LINE_EDITING_OPTION 12 -#define NO_SITE_FILE_OPTION 13 +#define NO_INIT_SITE_OPTION 13 #define PERSIST_OPTION 14 #define SERVER_OPTION 15 #define TEXI_MACROS_FILE_OPTION 16 @@ -89,10 +89,15 @@ // Option for developers, not displayed in help { "no-gui-libs", octave_no_arg, nullptr, NO_GUI_LIBS_OPTION }, { "no-history", octave_no_arg, nullptr, 'H' }, - { "no-init-file", octave_no_arg, nullptr, NO_INIT_FILE_OPTION }, + { "no-init-all", octave_no_arg, nullptr, 'f' }, + // Alias for --no-init-user, not displayed in help + { "no-init-file", octave_no_arg, nullptr, NO_INIT_USER_OPTION }, { "no-init-path", octave_no_arg, nullptr, NO_INIT_PATH_OPTION }, + { "no-init-user", octave_no_arg, nullptr, NO_INIT_PATH_OPTION }, { "no-line-editing", octave_no_arg, nullptr, NO_LINE_EDITING_OPTION }, - { "no-site-file", octave_no_arg, nullptr, NO_SITE_FILE_OPTION }, + { "no-init-site", octave_no_arg, nullptr, NO_INIT_SITE_OPTION }, + // Alias for --no-init-site, not displayed in help + { "no-site-file", octave_no_arg, nullptr, NO_INIT_SITE_OPTION }, { "no-window-system", octave_no_arg, nullptr, 'W' }, { "norc", octave_no_arg, nullptr, 'f' }, { "path", octave_required_arg, nullptr, 'p' },
--- a/libinterp/usage.h Tue Jan 02 13:42:37 2024 -0800 +++ b/libinterp/usage.h Tue Jan 02 16:12:16 2024 -0800 @@ -36,10 +36,10 @@ static const char *usage_string = "octave [-GHVWefghiqvx] [--echo-commands] [--eval CODE]\n\ [--experimental-terminal-widget] [--gui] [--help] [--interactive]\n\ - [--line-editing] [--no-gui] [--no-history] [--no-init-file]\n\ - [--no-init-path] [--no-line-editing] [--no-site-file]\n\ - [--no-window-system] [--norc] [--path path] [--persist] [--server]\n\ - [--silent] [--traditional] [--version] [file]"; + [--line-editing] [--no-gui] [--no-history] [--no-init-all]\n\ + [--no-init-path] [--no-init-site] [--no-init-user]\n\ + [--no-line-editing] [--no-window-system] [--path path] [--persist]\n\ + [--server] [--silent] [--traditional] [--version] [file]"; // Usage message with extra help. @@ -68,12 +68,13 @@ --line-editing Force readline use for command-line editing.\n\ --no-gui, -G Disable the graphical user interface.\n\ --no-history, -H Don't save commands to the history list\n\ - --no-init-file Don't read the ~/.octaverc or .octaverc files.\n\ + --no-init-all, --norc, -f\n\ + Don't read any initialization files.\n\ --no-init-path Don't initialize function search path.\n\ + --no-init-site Don't read the site-wide octaverc files.\n\ + --no-init-user Don't read the ~/.octaverc or .octaverc files.\n\ --no-line-editing Don't use readline for command-line editing.\n\ - --no-site-file Don't read the site-wide octaverc file.\n\ --no-window-system, -W Disable window system, including graphics.\n\ - --norc, -f Don't read any initialization files.\n\ --path PATH, -p PATH Add PATH to head of function search path.\n\ --persist Go interactive after --eval or reading from FILE.\n\ --server Enter server mode at startup.\n\