Skip to content

Commit

Permalink
removing comments
Browse files Browse the repository at this point in the history
  • Loading branch information
BitlyTwiser committed Sep 14, 2024
1 parent 083dd7a commit 9d4dedb
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 38 deletions.
3 changes: 0 additions & 3 deletions src/config.zig
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,9 @@ pub const YamlConfig = struct {
self.allocator,
self.yml_location,
);
// Free these later!
// defer self.allocator.free(yml_path);

var ymlz = try Ymlz(Config).init(self.allocator);
const result = try ymlz.loadFile(yml_path);
// defer ymlz.deinit(result);

return result;
}
Expand Down
1 change: 1 addition & 0 deletions src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub fn main() !void {

var yml_config = try config.YamlConfig.init(allocator, args[1]);
const results = try yml_config.parseConfig();
defer allocator.free(results.apps);

// Spawns all threads and waits
var run = try runner.Runner.init(allocator);
Expand Down
36 changes: 1 addition & 35 deletions src/runner.zig
Original file line number Diff line number Diff line change
@@ -1,35 +1,6 @@
const std = @import("std");
const config = @import("./config.zig");
const print = std.debug.print;
// We are basically going to
// 1: Parse yaml file for commands, start location, and if standalone (i.e. no specific folder)
// 2: spawn new windows for each command, rename (with name variable), and run command.
// 3: $$$ profit

// Basically do this
// # Start a new tmux session named 'my_session'
// tmux new-session -s sesssion // Take name of session from YAML

// # Rename the first window and run a command in it
// tmux rename-window -t my_session:0 'Window1'
// tmux send-keys -t my_session:0 'top' C-m

// # Create a second window, name it, and run a command
// tmux new-window -t my_session -n 'Window2'
// tmux send-keys -t my_session:1 'htop' C-m

// # Create a third window, name it, and run a command
// tmux new-window -t my_session -n 'Window3'
// tmux send-keys -t my_session:2 'ping google.com' C-m

// # Create a fourth window, name it, and run a command
// tmux new-window -t my_session -n 'Window4'
// tmux send-keys -t my_session:3 'tail -f /var/log/syslog' C-m

// # Attach to the session (if you want to interact with it immediately)
// tmux attach -t my_session

// Find shell type, sh, bash, zsh etc..

const app_name = "apprunner";

Expand Down Expand Up @@ -75,11 +46,7 @@ pub const Runner = struct {
}

// tmux specific configurations
// tmux new-window -t my_session -n 'Window4'
// tmux send-keys -t my_session:3 'tail -f /var/log/syslog' C-m
// tmux rename-window -t my_session:0 'Window1'
// tmux new-session -s test_sesh \; rename-window -t test_sesh:0 penis \; send-keys -t test_sesh:0 'echo "hi" |base64' enter
// You can send commands by name, not only index: tmux new-session -s test_sesh \; rename-window -t test_sesh:0 penis \; send-keys -t test_sesh:penis 'echo "hi" |base64' enter
// You can send commands by name, not only index: tmux new-session -s test_sesh \; rename-window -t test_sesh:0 tester \; send-keys -t test_sesh:tester 'echo "hi" |base64' enter
fn tmuxConfig(self: *Self, name: []const u8, standalone: bool, command: []const u8, location: []const u8, index: usize) ![]u8 {
var r_command: []u8 = undefined;

Expand All @@ -99,7 +66,6 @@ pub const Runner = struct {
return r_command;
}

// CD to a dir as not standalone
r_command = try std.fmt.allocPrint(self.allocator, "tmux new-window -c {s} -t {s} -n {s} \\; send-keys -t {s}:{s} '{s}' enter", .{ location, app_name, name, app_name, name, command });

return r_command;
Expand Down

0 comments on commit 9d4dedb

Please sign in to comment.