aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authorGrace Yoder <grace_yoder@outlook.com>2026-06-30 14:32:23 -0600
committerGrace Yoder <grace_yoder@outlook.com>2026-06-30 16:33:26 -0600
commit63265d1d7e36c4150df3bdc00bfda2391a54b916 (patch)
tree5a428b02873517cd02f5f1bc4c74626fcc052882 /src/main.zig
parent8062e417f2c40cc45a422f8546b6dd76423cdb38 (diff)
misc: cleanup
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/main.zig b/src/main.zig
index 0725ae7..bb0aa14 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -10,7 +10,11 @@ pub fn main(init: std.process.Init) !void {
// This program should not be run interactively
if (try File.stdin().isTty(io)) {
- std.debug.print("This program is not meant to be run interactively. Please pipe into this program.\n", .{});
+ std.debug.print(
+ \\ This program is not meant to be run interactively.
+ \\ Please pipe into this program.
+ \\
+ , .{});
std.process.exit(1);
}
@@ -19,27 +23,29 @@ pub fn main(init: std.process.Init) !void {
const alloc = std.heap.page_allocator;
const size = std.heap.pageSize();
- const is_ssh = init.environ_map.get("SSH_CONNECTION") != null or
+ const is_ssh =
+ init.environ_map.get("SSH_CONNECTION") != null or
init.environ_map.get("SSH_CLIENT") != null or
init.environ_map.get("SSH_TTY") != null;
- // This can be cleaned up
if (is_ssh) {
var clip = try Clip.OSC52.init(alloc, io, size);
defer clip.free();
try run(io, &clip);
- } else {
- if (comptime os == .macos) {
- var clip = try Clip.NSPasteboard.init(alloc, io, size);
- defer clip.free();
- try run(io, &clip);
- } else {
- // No Linux Clipboards yet
- var clip = try Clip.OSC52.init(alloc, io, size);
- defer clip.free();
- try run(io, &clip);
- }
+ return;
}
+
+ if (comptime os == .macos) {
+ var clip = try Clip.NSPasteboard.init(alloc, io, size);
+ defer clip.free();
+ try run(io, &clip);
+ return;
+ }
+
+ // Fallback Clipboard
+ var clip = try Clip.OSC52.init(alloc, io, size);
+ defer clip.free();
+ try run(io, &clip);
}
pub fn run(io: std.Io, clip: anytype) !void {