GNU Octave 11.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
usage.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1993-2026 The Octave Project Developers
4//
5// See the file COPYRIGHT.md in the top-level directory of this
6// distribution or <https://octave.org/copyright/>.
7//
8// This file is part of Octave.
9//
10// Octave is free software: you can redistribute it and/or modify it
11// under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14//
15// Octave is distributed in the hope that it will be useful, but
16// WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18// GNU General Public License for more details.
19//
20// You should have received a copy of the GNU General Public License
21// along with Octave; see the file COPYING. If not, see
22// <https://www.gnu.org/licenses/>.
23//
24////////////////////////////////////////////////////////////////////////
25
26#if ! defined (octave_usage_h)
27#define octave_usage_h 1
28
29#include "octave-config.h"
30
31#include <cstdlib>
32
33#include <iosfwd>
34
35#include "version.h"
36
37// Usage message for terse output.
38static const char *usage_string =
39 "octave [-GHVWefghiqvx] [--echo-commands] [--eval CODE]\n\
40 [--experimental-terminal-widget] [--gui] [--help] [--interactive]\n\
41 [--line-editing] [--no-gui] [--no-history] [--no-init-all]\n\
42 [--no-init-path] [--no-init-site] [--no-init-user]\n\
43 [--no-line-editing] [--no-startup-tests] [--no-window-system]\n\
44 [--path path] [--persist] [--quiet] [--server] [--traditional]\n\
45 [--version] [file]";
46
47// Usage message for --help argument.
48static void
49octave_print_verbose_usage_and_exit ()
50{
52\n\
53Usage: octave [options] [FILE]\n\
54\n\
55Options:\n\
56\n"
57// FIXME: Disabled debug option for parser 2023-12-29.
58// Uncomment and restore code if Octave adds capability to
59// immediately enter debug mode for a script.
60//--debug, -d Enter debugging mode.\n\ //
61"\
62 --echo-commands, -x Echo commands as they are executed.\n\
63 --eval, -e CODE Evaluate CODE. Exit when done unless --persist.\n\
64 --experimental-terminal-widget\n\
65 Use new experimental terminal widget in the GUI.\n\
66 --gui, -g Start the graphical user interface.\n\
67 --help, -h, Print short help message and exit.\n\
68 --interactive, -i Force interactive behavior.\n\
69 --line-editing Force readline use for command-line editing.\n\
70 --no-gui, -G Disable the graphical user interface.\n\
71 --no-history, -H Don't save commands to the history list\n\
72 --no-init-all, --norc, -f\n\
73 Don't read any initialization files.\n\
74 --no-init-path Don't initialize function search path.\n\
75 --no-init-site Don't read the site-wide octaverc files.\n\
76 --no-init-user Don't read the ~/.octaverc or .octaverc files.\n\
77 --no-line-editing Don't use readline for command-line editing.\n\
78 --no-startup-tests Don't run compatibility tests on startup.\n\
79 --no-window-system, -W Disable window system, including graphics.\n\
80 --path PATH, -p PATH Add PATH to head of function search path.\n\
81 --persist Go interactive after --eval or reading from FILE.\n\
82 --server Enter server mode at startup.\n\
83 --quiet, --silent, -q Don't print message at startup.\n\
84 --traditional Set variables for closer MATLAB compatibility.\n\
85 --version, -v Print version information and exit.\n\
86\n\
87 FILE Execute commands from FILE. Exit when done\n\
88 unless --persist is also specified.\n\
89\n"
90 << octave_www_statement () << "\n"
91 << octave_bugs_statement () << "\n"
92 << octave_contrib_statement () << "\n";
93
94 std::exit (EXIT_SUCCESS);
95}
96
97// Terse usage message when argument is not recognized.
98static void
99octave_print_terse_usage_and_exit ()
100{
101 std::cerr << "\nusage: " << usage_string << "\n\n";
102
103 std::exit (EXIT_FAILURE);
104}
105
106// Version message for --version argument.
107static void
108octave_print_version_and_exit ()
109{
111 << "\n";
112 std::exit (EXIT_SUCCESS);
113}
114
115#endif
std::string octave_name_version_copyright_license_copying_warranty(bool html, const std::string &extra_info)
Definition version.cc:96
std::string octave_bugs_statement(bool html)
Definition version.cc:51
std::string octave_www_statement(bool html)
Definition version.cc:44
std::string octave_name_version_copyright_license_copying_warranty_bugs(bool html, const std::string &extra_info)
Definition version.cc:109
std::string octave_contrib_statement(bool html)
Definition version.cc:58