markdown-ify help strings

This commit is contained in:
Jeffrey C. Ollie
2024-01-21 14:22:50 -06:00
parent ef09fa89b0
commit 510f270c54
8 changed files with 497 additions and 493 deletions

View File

@ -3,9 +3,9 @@ const Allocator = std.mem.Allocator;
const args = @import("args.zig");
const Action = @import("action.zig").Action;
// Note that this options struct doesn't implement the `help` decl like
// other actions. That is because the help command is special and wants to
// handle its own logic around help detection.
// Note that this options struct doesn't implement the `help` decl like other
// actions. That is because the help command is special and wants to handle its
// own logic around help detection.
pub const Options = struct {
/// This must be registered so that it isn't an error to pass `--help`
help: bool = false,
@ -15,9 +15,9 @@ pub const Options = struct {
}
};
/// The `help` command shows general help about Ghostty. You can also
/// specify `--help` or `-h` along with any action such as `+list-themes`
/// to see help for a specific action.
/// The `help` command shows general help about Ghostty. You can also specify
/// `--help` or `-h` along with any action such as `+list-themes` to see help
/// for a specific action.
pub fn run(alloc: Allocator) !u8 {
var opts: Options = .{};
defer opts.deinit();

View File

@ -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.
pub fn run(alloc: std.mem.Allocator) !u8 {
var opts: Options = .{};

View File

@ -35,22 +35,21 @@ pub const Config = struct {
}
};
/// The list-fonts command is used to list all the available fonts for Ghostty.
/// This uses the exact same font discovery mechanism Ghostty uses to find
/// fonts to use.
/// The `list-fonts` command is used to list all the available fonts for
/// Ghostty. This uses the exact same font discovery mechanism Ghostty uses to
/// find fonts to use.
///
/// When executed with no arguments, this will list all available fonts,
/// sorted by family name, then font name. If a family name is given
/// with "--family", the sorting will be disabled and the results instead
/// will be shown in the same priority order Ghostty would use to pick a
/// font.
/// When executed with no arguments, this will list all available fonts, sorted
/// by family name, then font name. If a family name is given with `--family`,
/// the sorting will be disabled and the results instead will be shown in the
/// same priority order Ghostty would use to pick a font.
///
/// 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
/// configuration values, so this can be used to debug why your desired font
/// may not be loading.
/// 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
/// configuration values, so this can be used to debug why your desired font may
/// 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,
/// it will just prioriiize fonts that match those styles.
pub fn run(alloc: Allocator) !u8 {

View File

@ -23,16 +23,16 @@ pub const Options = struct {
}
};
/// The "list-keybinds" command is used to list all the available keybinds
/// for Ghostty.
/// The `list-keybinds` command is used to list all the available keybinds for
/// Ghostty.
///
/// 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
/// changes to the keybinds it will print out the default ones configured for
/// Ghostty
///
/// The "--default" argument will print out all the default keybinds
/// configured for Ghostty
/// The `--default` argument will print out all the default keybinds configured
/// for Ghostty
pub fn run(alloc: Allocator) !u8 {
var opts: Options = .{};
defer opts.deinit();

View File

@ -19,15 +19,15 @@ pub const Options = struct {
}
};
/// The "list-themes" command is used to list all the available themes
/// for Ghostty.
/// The `list-themes` command is used to list all the available themes for
/// Ghostty.
///
/// Themes require that Ghostty have access to the resources directory.
/// On macOS this is embedded in the app bundle. On Linux, this is usually
/// in `/usr/share/ghostty`. If you're compiling from source, this is the
/// `zig-out/share/ghostty` directory. You can also set the `GHOSTTY_RESOURCES_DIR`
/// environment variable to point to the resources directory. Themes
/// live in the `themes` subdirectory of the resources directory.
/// Themes require that Ghostty have access to the resources directory. On macOS
/// this is embedded in the app bundle. On Linux, this is usually in `/usr/
/// share/ghostty`. If you're compiling from source, this is the `zig-out/share/
/// ghostty` directory. You can also set the `GHOSTTY_RESOURCES_DIR` environment
/// variable to point to the resources directory. Themes live in the `themes`
/// subdirectory of the resources directory.
pub fn run(alloc: Allocator) !u8 {
var opts: Options = .{};
defer opts.deinit();

View File

@ -21,15 +21,15 @@ pub const Options = struct {
_ = self;
}
/// Enables "-h" and "--help" to work.
/// Enables `-h` and `--help` to work.
pub fn help(self: Options) !void {
_ = self;
return Action.help_error;
}
};
/// The "show-config" command shows the current configuration in a valid
/// Ghostty configuration file format.
/// The `show-config` command shows the current configuration in a valid Ghostty
/// configuration file format.
///
/// When executed without any arguments this will output the current
/// 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
/// documentation, run `ghostty +show-config --default --docs`.
///
/// The output is not in any specific order, but the order should be
/// consistent between runs. The output is not guaranteed to be exactly
/// match the input configuration files, but it will result in the same
/// behavior. Comments, whitespace, and other formatting is not preserved
/// from user configuration files.
/// The output is not in any specific order, but the order should be consistent
/// between runs. The output is not guaranteed to be exactly match the input
/// configuration files, but it will result in the same behavior. Comments,
/// whitespace, and other formatting is not preserved from user configuration
/// files.
///
/// Flags:
///
/// - "--default": Show the default configuration instead of loading
/// * `--default`: Show the default configuration instead of loading
/// the user configuration.
///
/// - "--changes-only": Only show the options that have been changed
/// from the default. This has no effect if "--default" is specified.
/// * `--changes-only`: Only show the options that have been changed
/// 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
/// options, especially paired with "--default".
///
/// options, especially paired with `--default`.
pub fn run(alloc: Allocator) !u8 {
var opts: Options = .{};
defer opts.deinit();

View File

@ -12,15 +12,14 @@ pub const Options = struct {
_ = self;
}
/// Enables "-h" and "--help" to work.
/// Enables `-h` and `--help` to work.
pub fn help(self: Options) !void {
_ = self;
return Action.help_error;
}
};
/// The `version` command is used to display information
/// about Ghostty.
/// The `version` command is used to display information about Ghostty.
pub fn run(alloc: Allocator) !u8 {
var opts: Options = .{};
defer opts.deinit();
@ -34,6 +33,7 @@ pub fn run(alloc: Allocator) !u8 {
const stdout = std.io.getStdOut().writer();
try stdout.print("Ghostty {s}\n\n", .{build_config.version_string});
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(" - app runtime: {}\n", .{build_config.app_runtime});
try stdout.print(" - font engine: {}\n", .{build_config.font_backend});

File diff suppressed because it is too large Load Diff