diff options
author | Joe <rbo@gmx.us> | 2024-01-31 20:20:20 +0100 |
---|---|---|
committer | Joe <rbo@gmx.us> | 2024-01-31 20:20:20 +0100 |
commit | d6162141a3d34e594816d657ed36c1b7ddb48eeb (patch) | |
tree | 94cf3ceacf6f03cc6289c3c3ba994264a588a3c6 /src | |
parent | way better roadmap (diff) | |
download | hardflip-d6162141a3d34e594816d657ed36c1b7ddb48eeb.tar.gz hardflip-d6162141a3d34e594816d657ed36c1b7ddb48eeb.tar.bz2 hardflip-d6162141a3d34e594816d657ed36c1b7ddb48eeb.tar.xz hardflip-d6162141a3d34e594816d657ed36c1b7ddb48eeb.tar.zst hardflip-d6162141a3d34e594816d657ed36c1b7ddb48eeb.zip |
good start
Diffstat (limited to 'src')
-rw-r--r-- | src/c_exec.go | 6 | ||||
-rw-r--r-- | src/c_hardflip.go | 2 | ||||
-rw-r--r-- | src/c_init.go | 3 | ||||
-rw-r--r-- | src/c_parse.go | 6 |
4 files changed, 13 insertions, 4 deletions
diff --git a/src/c_exec.go b/src/c_exec.go index 129ff89..145d1f0 100644 --- a/src/c_exec.go +++ b/src/c_exec.go @@ -84,8 +84,12 @@ func c_format_ssh_jump(host *HostNode) string { } func c_format_ssh(host *HostNode) []string { - cmd_fmt := []string{"ssh"} + cmd_fmt := []string{} + if len(host.Pass) > 0 { + cmd_fmt = append(cmd_fmt, "sshpass", "-p", host.Pass) + } + cmd_fmt = append(cmd_fmt, "ssh") if len(host.Priv) > 0 { cmd_fmt = append(cmd_fmt, "-i", host.Priv) } diff --git a/src/c_hardflip.go b/src/c_hardflip.go index fa6dfb4..fc6ca69 100644 --- a/src/c_hardflip.go +++ b/src/c_hardflip.go @@ -64,6 +64,6 @@ type HardData struct { func main() { data_dir := c_get_data_dir(nil) - opts := HardOpts{true, true, false, ""} + opts := HardOpts{true, true, "plain", false, ""} i_ui(data_dir, opts) } diff --git a/src/c_init.go b/src/c_init.go index 5c9f115..8981099 100644 --- a/src/c_init.go +++ b/src/c_init.go @@ -59,6 +59,7 @@ import ( type HardOpts struct { Icon bool Loop bool + GPG string Perc bool Term string } @@ -89,7 +90,7 @@ func c_recurse_data_dir(dir, root string, opts HardOpts, c_recurse_data_dir(dir + filename + "/", root, opts, ldirs, file.Name(), &dir_node, depth + 1, ui, load_err) } else if filepath.Ext(filename) == ".yml" { - host_node, err := c_read_yaml_file(root + dir + filename, ui) + host_node, err := c_read_yaml_file(root + dir + filename, opts, ui) if err != nil { *load_err = append(*load_err, err) } else if host_node != nil { diff --git a/src/c_parse.go b/src/c_parse.go index faa8223..3a58558 100644 --- a/src/c_parse.go +++ b/src/c_parse.go @@ -58,7 +58,8 @@ import ( "gopkg.in/yaml.v3" ) -func c_read_yaml_file(file string, ui *HardUI) (*HostNode, error) { +func c_read_yaml_file(file string, + opts HardOpts, ui *HardUI) (*HostNode, error) { var host HostNode yaml_file, err := os.ReadFile(file) @@ -68,6 +69,9 @@ func c_read_yaml_file(file string, ui *HardUI) (*HostNode, error) { if err := yaml.Unmarshal(yaml_file, &host); err != nil { return nil, err } + if len(opts.GPG) == 0 { + host.Pass = "" + } if len(host.Name) == 0 { return nil, nil } |