mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-01-04 20:37:50 +00:00
input configuration to pass input as stdin on startup
This adds a new configuration `input` that allows passing either raw text or file contents as stdin when starting the terminal. The input is sent byte-for-byte to the terminal, so control characters such as `\n` will be interpreted by the shell and can be used to run programs in the context of the loaded shell. Example: `ghostty --input="hello, world\n"` will start the your default shell, run `echo hello, world`, and then show the prompt.
This commit is contained in:
@@ -414,7 +414,7 @@ pub fn parseIntoField(
|
||||
return error.InvalidField;
|
||||
}
|
||||
|
||||
fn parseTaggedUnion(comptime T: type, alloc: Allocator, v: []const u8) !T {
|
||||
pub fn parseTaggedUnion(comptime T: type, alloc: Allocator, v: []const u8) !T {
|
||||
const info = @typeInfo(T).@"union";
|
||||
assert(@typeInfo(info.tag_type.?) == .@"enum");
|
||||
|
||||
@@ -1090,6 +1090,7 @@ test "parseIntoField: tagged union" {
|
||||
b: u8,
|
||||
c: void,
|
||||
d: []const u8,
|
||||
e: [:0]const u8,
|
||||
} = undefined,
|
||||
} = .{};
|
||||
|
||||
@@ -1108,6 +1109,10 @@ test "parseIntoField: tagged union" {
|
||||
// Set string field
|
||||
try parseIntoField(@TypeOf(data), alloc, &data, "value", "d:hello");
|
||||
try testing.expectEqualStrings("hello", data.value.d);
|
||||
|
||||
// Set sentinel string field
|
||||
try parseIntoField(@TypeOf(data), alloc, &data, "value", "e:hello");
|
||||
try testing.expectEqualStrings("hello", data.value.e);
|
||||
}
|
||||
|
||||
test "parseIntoField: tagged union unknown filed" {
|
||||
|
||||
Reference in New Issue
Block a user