mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-02 21:02:01 +08:00
77aeb6a2a8
Drop support for history file version 1. ParseExecutionContext no longer contains an OperationContext because in my first implementation, ParseExecutionContext didn't have interior mutability. We should probably try to add it back. Add a few to-do style comments. Search for "todo!" and "PORTING". Co-authored-by: Xiretza <xiretza@xiretza.xyz> (complete, wildcard, expand, history, history/file) Co-authored-by: Henrik Hørlück Berg <36937807+henrikhorluck@users.noreply.github.com> (builtins/set)
92 lines
3.4 KiB
C++
92 lines
3.4 KiB
C++
// Prototypes for functions for executing builtin functions.
|
|
#ifndef FISH_BUILTIN_H
|
|
#define FISH_BUILTIN_H
|
|
|
|
#include <vector>
|
|
|
|
#include "common.h"
|
|
#include "complete.h"
|
|
#include "maybe.h"
|
|
#include "wutil.h"
|
|
|
|
struct Parser;
|
|
struct IoStreams;
|
|
|
|
using parser_t = Parser;
|
|
using io_streams_t = IoStreams;
|
|
|
|
class proc_status_t;
|
|
struct OutputStreamFfi;
|
|
using output_stream_t = OutputStreamFfi;
|
|
struct CompletionListFfi;
|
|
using completion_list_t = CompletionListFfi;
|
|
|
|
/// Data structure to describe a builtin.
|
|
struct builtin_data_t {
|
|
// Name of the builtin.
|
|
const wchar_t *name;
|
|
// Function pointer to the builtin implementation.
|
|
maybe_t<int> (*func)(const parser_t &parser, io_streams_t &streams, const wchar_t **argv);
|
|
// Description of what the builtin does.
|
|
const wchar_t *desc;
|
|
};
|
|
|
|
/// The default prompt for the read command.
|
|
#define DEFAULT_READ_PROMPT L"set_color green; echo -n read; set_color normal; echo -n \"> \""
|
|
|
|
/// Error message on missing argument.
|
|
#define BUILTIN_ERR_MISSING _(L"%ls: %ls: option requires an argument\n")
|
|
|
|
/// Error message on missing man page.
|
|
#define BUILTIN_ERR_MISSING_HELP \
|
|
_(L"fish: %ls: missing man page\nDocumentation may not be installed.\n`help %ls` will " \
|
|
L"show an online version\n")
|
|
|
|
/// Error message on invalid combination of options.
|
|
#define BUILTIN_ERR_COMBO _(L"%ls: invalid option combination\n")
|
|
|
|
/// Error message on invalid combination of options.
|
|
#define BUILTIN_ERR_COMBO2 _(L"%ls: invalid option combination, %ls\n")
|
|
#define BUILTIN_ERR_COMBO2_EXCLUSIVE _(L"%ls: %ls %ls: options cannot be used together\n")
|
|
|
|
/// Error message on multiple scope levels for variables.
|
|
#define BUILTIN_ERR_GLOCAL _(L"%ls: scope can be only one of: universal function global local\n")
|
|
|
|
/// Error message for specifying both export and unexport to set/read.
|
|
#define BUILTIN_ERR_EXPUNEXP _(L"%ls: cannot both export and unexport\n")
|
|
|
|
/// Error message for unknown switch.
|
|
#define BUILTIN_ERR_UNKNOWN _(L"%ls: %ls: unknown option\n")
|
|
|
|
/// Error message for unexpected args.
|
|
#define BUILTIN_ERR_ARG_COUNT0 _(L"%ls: missing argument\n")
|
|
#define BUILTIN_ERR_ARG_COUNT1 _(L"%ls: expected %d arguments; got %d\n")
|
|
#define BUILTIN_ERR_ARG_COUNT2 _(L"%ls: %ls: expected %d arguments; got %d\n")
|
|
#define BUILTIN_ERR_MIN_ARG_COUNT1 _(L"%ls: expected >= %d arguments; got %d\n")
|
|
#define BUILTIN_ERR_MAX_ARG_COUNT1 _(L"%ls: expected <= %d arguments; got %d\n")
|
|
|
|
/// Error message for invalid variable name.
|
|
#define BUILTIN_ERR_VARNAME _(L"%ls: %ls: invalid variable name. See `help identifiers`\n")
|
|
|
|
/// Error message for invalid bind mode name.
|
|
#define BUILTIN_ERR_BIND_MODE _(L"%ls: %ls: invalid mode name. See `help identifiers`\n")
|
|
|
|
/// Error message when too many arguments are supplied to a builtin.
|
|
#define BUILTIN_ERR_TOO_MANY_ARGUMENTS _(L"%ls: too many arguments\n")
|
|
|
|
/// Error message when integer expected
|
|
#define BUILTIN_ERR_NOT_NUMBER _(L"%ls: %ls: invalid integer\n")
|
|
|
|
/// Command that requires a subcommand was invoked without a recognized subcommand.
|
|
#define BUILTIN_ERR_MISSING_SUBCMD _(L"%ls: missing subcommand\n")
|
|
#define BUILTIN_ERR_INVALID_SUBCMD _(L"%ls: %ls: invalid subcommand\n")
|
|
|
|
/// The send stuff to foreground message.
|
|
#define FG_MSG _(L"Send job %d (%ls) to foreground\n")
|
|
|
|
int builtin_count_args(const wchar_t *const *argv);
|
|
|
|
void builtin_wperror(const wchar_t *program_name, io_streams_t &streams);
|
|
|
|
#endif
|