wxMaxima
Loading...
Searching...
No Matches
CommandLine.h
Go to the documentation of this file.
1// -*- mode: c++; c-file-style: "linux"; c-basic-offset: 2; indent-tabs-mode: nil -*-
2//
3// Copyright (C) 2026 Gunter Königsmann <wxMaxima@physikbuch.de>
4//
5// This program is free software; you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation; either version 2 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15//
16// You should have received a copy of the GNU General Public License
17// along with this program; if not, write to the Free Software
18// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19//
20// SPDX-License-Identifier: GPL-2.0+
21
35#ifndef WXM_COMMANDLINE_H
36#define WXM_COMMANDLINE_H
37
38#include <wx/cmdline.h>
39#include <wx/string.h>
40
41#include <optional>
42#include <vector>
43
44namespace wxm::cmdline {
45
51const wxCmdLineEntryDesc *ParserDescription();
52
68std::vector<wxString> DiffAliasArguments(const std::vector<wxString> &args);
69
71void SetArguments(wxCmdLineParser &parser, const std::vector<wxString> &args);
72
94int Parse(wxCmdLineParser &parser, const std::vector<wxString> &args,
95 bool showUsage = true);
96
102wxString CanonicalFileArgument(const wxString &arg);
103
105struct Settings {
106 bool version = false;
107 bool batch = false;
108 bool eval = false;
109 bool diff = false;
110 bool singleProcess = false;
111 bool singleThread = false;
112 bool logToStderr = false;
113 bool debug = false;
114 bool pipe = false;
115 bool exitOnError = false;
116 bool enableIpc = false;
118 std::optional<wxString> ini;
120 std::optional<wxString> wxMathMLLisp;
122 std::optional<wxString> maxima;
124 std::optional<wxString> screenshot;
128 std::vector<wxString> params;
134 std::vector<wxString> filesToOpen;
135};
136
143Settings Interpret(const wxCmdLineParser &parser);
144
145} // namespace wxm::cmdline
146
147#endif // WXM_COMMANDLINE_H
std::vector< wxString > DiffAliasArguments(const std::vector< wxString > &args)
The arguments wxMaxima acts on, if it was started under this name.
Definition: CommandLine.cpp:82
Settings Interpret(const wxCmdLineParser &parser)
Reads the settings out of a parser that has already run Parse()
Definition: CommandLine.cpp:218
wxString CanonicalFileArgument(const wxString &arg)
A file name from the command line, made absolute.
Definition: CommandLine.cpp:203
int Parse(wxCmdLineParser &parser, const std::vector< wxString > &args, bool showUsage)
Parses the arguments (program first) with wxMaxima's options.
Definition: CommandLine.cpp:156
const wxCmdLineEntryDesc * ParserDescription()
The wxCmdLineParser description, made from wxm::cmdline::Options.
Definition: CommandLine.cpp:39
void SetArguments(wxCmdLineParser &parser, const std::vector< wxString > &args)
Hands an argument vector (program first) to the parser, unmodified.
Definition: CommandLine.cpp:102
What the user asked for on the command line.
Definition: CommandLine.h:105
std::vector< wxString > params
The positional arguments, as given (the files –diff compares)
Definition: CommandLine.h:128
bool enableIpc
–enableipc –ini: the configuration file, made absolute
Definition: CommandLine.h:116
bool version
–version
Definition: CommandLine.h:106
bool exitOnError
–exit-on-error
Definition: CommandLine.h:115
bool pipe
–pipe
Definition: CommandLine.h:114
wxString extraMaximaArgs
What –lisp, –extra-args and –use-version add to Maxima's command line.
Definition: CommandLine.h:126
bool singleProcess
–single_process
Definition: CommandLine.h:110
std::optional< wxString > screenshot
–screenshot: the PNG file to write, made absolute
Definition: CommandLine.h:124
std::optional< wxString > wxMathMLLisp
–wxmathml-lisp
Definition: CommandLine.h:120
bool eval
–eval
Definition: CommandLine.h:108
bool debug
–debug
Definition: CommandLine.h:113
std::vector< wxString > filesToOpen
The files to open, each in a window of its own, made absolute.
Definition: CommandLine.h:134
bool singleThread
–single_thread
Definition: CommandLine.h:111
bool logToStderr
–logtostderr
Definition: CommandLine.h:112
std::optional< wxString > maxima
–maxima: the Maxima binary
Definition: CommandLine.h:122
bool batch
–batch
Definition: CommandLine.h:107
bool diff
–diff
Definition: CommandLine.h:109