mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 16:26:08 +03:00
markdown-ify help strings
This commit is contained in:
@ -3,9 +3,9 @@ const Allocator = std.mem.Allocator;
|
|||||||
const args = @import("args.zig");
|
const args = @import("args.zig");
|
||||||
const Action = @import("action.zig").Action;
|
const Action = @import("action.zig").Action;
|
||||||
|
|
||||||
// Note that this options struct doesn't implement the `help` decl like
|
// Note that this options struct doesn't implement the `help` decl like other
|
||||||
// other actions. That is because the help command is special and wants to
|
// actions. That is because the help command is special and wants to handle its
|
||||||
// handle its own logic around help detection.
|
// own logic around help detection.
|
||||||
pub const Options = struct {
|
pub const Options = struct {
|
||||||
/// This must be registered so that it isn't an error to pass `--help`
|
/// This must be registered so that it isn't an error to pass `--help`
|
||||||
help: bool = false,
|
help: bool = false,
|
||||||
@ -15,9 +15,9 @@ pub const Options = struct {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// The `help` command shows general help about Ghostty. You can also
|
/// The `help` command shows general help about Ghostty. You can also specify
|
||||||
/// specify `--help` or `-h` along with any action such as `+list-themes`
|
/// `--help` or `-h` along with any action such as `+list-themes` to see help
|
||||||
/// to see help for a specific action.
|
/// for a specific action.
|
||||||
pub fn run(alloc: Allocator) !u8 {
|
pub fn run(alloc: Allocator) !u8 {
|
||||||
var opts: Options = .{};
|
var opts: Options = .{};
|
||||||
defer opts.deinit();
|
defer opts.deinit();
|
||||||
|
@ -15,7 +15,7 @@ pub const Options = struct {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// The "list-colors" command is used to list all the named RGB colors in
|
/// The `list-colors` command is used to list all the named RGB colors in
|
||||||
/// Ghostty.
|
/// Ghostty.
|
||||||
pub fn run(alloc: std.mem.Allocator) !u8 {
|
pub fn run(alloc: std.mem.Allocator) !u8 {
|
||||||
var opts: Options = .{};
|
var opts: Options = .{};
|
||||||
|
@ -35,22 +35,21 @@ pub const Config = struct {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// The list-fonts command is used to list all the available fonts for Ghostty.
|
/// The `list-fonts` command is used to list all the available fonts for
|
||||||
/// This uses the exact same font discovery mechanism Ghostty uses to find
|
/// Ghostty. This uses the exact same font discovery mechanism Ghostty uses to
|
||||||
/// fonts to use.
|
/// find fonts to use.
|
||||||
///
|
///
|
||||||
/// When executed with no arguments, this will list all available fonts,
|
/// When executed with no arguments, this will list all available fonts, sorted
|
||||||
/// sorted by family name, then font name. If a family name is given
|
/// by family name, then font name. If a family name is given with `--family`,
|
||||||
/// with "--family", the sorting will be disabled and the results instead
|
/// the sorting will be disabled and the results instead will be shown in the
|
||||||
/// will be shown in the same priority order Ghostty would use to pick a
|
/// same priority order Ghostty would use to pick a font.
|
||||||
/// font.
|
|
||||||
///
|
///
|
||||||
/// The "--family" argument can be used to filter results to a specific family.
|
/// The `--family` argument can be used to filter results to a specific family.
|
||||||
/// The family handling is identical to the "font-familiy" set of Ghostty
|
/// The family handling is identical to the `font-familiy` set of Ghostty
|
||||||
/// configuration values, so this can be used to debug why your desired font
|
/// configuration values, so this can be used to debug why your desired font may
|
||||||
/// may not be loading.
|
/// not be loading.
|
||||||
///
|
///
|
||||||
/// The "--bold" and "--italic" arguments can be used to filter results to
|
/// The `--bold` and `--italic` arguments can be used to filter results to
|
||||||
/// specific styles. It is not guaranteed that only those styles are returned,
|
/// specific styles. It is not guaranteed that only those styles are returned,
|
||||||
/// it will just prioriiize fonts that match those styles.
|
/// it will just prioriiize fonts that match those styles.
|
||||||
pub fn run(alloc: Allocator) !u8 {
|
pub fn run(alloc: Allocator) !u8 {
|
||||||
|
@ -23,16 +23,16 @@ pub const Options = struct {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// The "list-keybinds" command is used to list all the available keybinds
|
/// The `list-keybinds` command is used to list all the available keybinds for
|
||||||
/// for Ghostty.
|
/// Ghostty.
|
||||||
///
|
///
|
||||||
/// When executed without any arguments this will list the current keybinds
|
/// When executed without any arguments this will list the current keybinds
|
||||||
/// loaded by the config file. If no config file is found or there aren't any
|
/// loaded by the config file. If no config file is found or there aren't any
|
||||||
/// changes to the keybinds it will print out the default ones configured for
|
/// changes to the keybinds it will print out the default ones configured for
|
||||||
/// Ghostty
|
/// Ghostty
|
||||||
///
|
///
|
||||||
/// The "--default" argument will print out all the default keybinds
|
/// The `--default` argument will print out all the default keybinds configured
|
||||||
/// configured for Ghostty
|
/// for Ghostty
|
||||||
pub fn run(alloc: Allocator) !u8 {
|
pub fn run(alloc: Allocator) !u8 {
|
||||||
var opts: Options = .{};
|
var opts: Options = .{};
|
||||||
defer opts.deinit();
|
defer opts.deinit();
|
||||||
|
@ -19,15 +19,15 @@ pub const Options = struct {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// The "list-themes" command is used to list all the available themes
|
/// The `list-themes` command is used to list all the available themes for
|
||||||
/// for Ghostty.
|
/// Ghostty.
|
||||||
///
|
///
|
||||||
/// Themes require that Ghostty have access to the resources directory.
|
/// Themes require that Ghostty have access to the resources directory. On macOS
|
||||||
/// On macOS this is embedded in the app bundle. On Linux, this is usually
|
/// this is embedded in the app bundle. On Linux, this is usually in `/usr/
|
||||||
/// in `/usr/share/ghostty`. If you're compiling from source, this is the
|
/// share/ghostty`. If you're compiling from source, this is the `zig-out/share/
|
||||||
/// `zig-out/share/ghostty` directory. You can also set the `GHOSTTY_RESOURCES_DIR`
|
/// ghostty` directory. You can also set the `GHOSTTY_RESOURCES_DIR` environment
|
||||||
/// environment variable to point to the resources directory. Themes
|
/// variable to point to the resources directory. Themes live in the `themes`
|
||||||
/// live in the `themes` subdirectory of the resources directory.
|
/// subdirectory of the resources directory.
|
||||||
pub fn run(alloc: Allocator) !u8 {
|
pub fn run(alloc: Allocator) !u8 {
|
||||||
var opts: Options = .{};
|
var opts: Options = .{};
|
||||||
defer opts.deinit();
|
defer opts.deinit();
|
||||||
|
@ -21,15 +21,15 @@ pub const Options = struct {
|
|||||||
_ = self;
|
_ = self;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Enables "-h" and "--help" to work.
|
/// Enables `-h` and `--help` to work.
|
||||||
pub fn help(self: Options) !void {
|
pub fn help(self: Options) !void {
|
||||||
_ = self;
|
_ = self;
|
||||||
return Action.help_error;
|
return Action.help_error;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// The "show-config" command shows the current configuration in a valid
|
/// The `show-config` command shows the current configuration in a valid Ghostty
|
||||||
/// Ghostty configuration file format.
|
/// configuration file format.
|
||||||
///
|
///
|
||||||
/// When executed without any arguments this will output the current
|
/// When executed without any arguments this will output the current
|
||||||
/// configuration that is different from the default configuration. If you're
|
/// configuration that is different from the default configuration. If you're
|
||||||
@ -38,24 +38,23 @@ pub const Options = struct {
|
|||||||
/// If you are a new user and want to see all available options with
|
/// If you are a new user and want to see all available options with
|
||||||
/// documentation, run `ghostty +show-config --default --docs`.
|
/// documentation, run `ghostty +show-config --default --docs`.
|
||||||
///
|
///
|
||||||
/// The output is not in any specific order, but the order should be
|
/// The output is not in any specific order, but the order should be consistent
|
||||||
/// consistent between runs. The output is not guaranteed to be exactly
|
/// between runs. The output is not guaranteed to be exactly match the input
|
||||||
/// match the input configuration files, but it will result in the same
|
/// configuration files, but it will result in the same behavior. Comments,
|
||||||
/// behavior. Comments, whitespace, and other formatting is not preserved
|
/// whitespace, and other formatting is not preserved from user configuration
|
||||||
/// from user configuration files.
|
/// files.
|
||||||
///
|
///
|
||||||
/// Flags:
|
/// Flags:
|
||||||
///
|
///
|
||||||
/// - "--default": Show the default configuration instead of loading
|
/// * `--default`: Show the default configuration instead of loading
|
||||||
/// the user configuration.
|
/// the user configuration.
|
||||||
///
|
///
|
||||||
/// - "--changes-only": Only show the options that have been changed
|
/// * `--changes-only`: Only show the options that have been changed
|
||||||
/// from the default. This has no effect if "--default" is specified.
|
/// from the default. This has no effect if `--default` is specified.
|
||||||
///
|
///
|
||||||
/// - "--docs": Print the documentation above each option as a comment,
|
/// * `--docs`: Print the documentation above each option as a comment,
|
||||||
/// This is very noisy but is very useful to learn about available
|
/// This is very noisy but is very useful to learn about available
|
||||||
/// options, especially paired with "--default".
|
/// options, especially paired with `--default`.
|
||||||
///
|
|
||||||
pub fn run(alloc: Allocator) !u8 {
|
pub fn run(alloc: Allocator) !u8 {
|
||||||
var opts: Options = .{};
|
var opts: Options = .{};
|
||||||
defer opts.deinit();
|
defer opts.deinit();
|
||||||
|
@ -12,15 +12,14 @@ pub const Options = struct {
|
|||||||
_ = self;
|
_ = self;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Enables "-h" and "--help" to work.
|
/// Enables `-h` and `--help` to work.
|
||||||
pub fn help(self: Options) !void {
|
pub fn help(self: Options) !void {
|
||||||
_ = self;
|
_ = self;
|
||||||
return Action.help_error;
|
return Action.help_error;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// The `version` command is used to display information
|
/// The `version` command is used to display information about Ghostty.
|
||||||
/// about Ghostty.
|
|
||||||
pub fn run(alloc: Allocator) !u8 {
|
pub fn run(alloc: Allocator) !u8 {
|
||||||
var opts: Options = .{};
|
var opts: Options = .{};
|
||||||
defer opts.deinit();
|
defer opts.deinit();
|
||||||
@ -34,6 +33,7 @@ pub fn run(alloc: Allocator) !u8 {
|
|||||||
const stdout = std.io.getStdOut().writer();
|
const stdout = std.io.getStdOut().writer();
|
||||||
try stdout.print("Ghostty {s}\n\n", .{build_config.version_string});
|
try stdout.print("Ghostty {s}\n\n", .{build_config.version_string});
|
||||||
try stdout.print("Build Config\n", .{});
|
try stdout.print("Build Config\n", .{});
|
||||||
|
try stdout.print(" - Zig version: {s}\n", .{builtin.zig_version_string});
|
||||||
try stdout.print(" - build mode : {}\n", .{builtin.mode});
|
try stdout.print(" - build mode : {}\n", .{builtin.mode});
|
||||||
try stdout.print(" - app runtime: {}\n", .{build_config.app_runtime});
|
try stdout.print(" - app runtime: {}\n", .{build_config.app_runtime});
|
||||||
try stdout.print(" - font engine: {}\n", .{build_config.font_backend});
|
try stdout.print(" - font engine: {}\n", .{build_config.font_backend});
|
||||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user