diff options
| author | joe <rbo@gmx.us> | 2025-08-29 11:22:41 +0200 | 
|---|---|---|
| committer | joe <rbo@gmx.us> | 2025-08-29 11:22:41 +0200 | 
| commit | bf05941247867b6dd1f0532a1159e3b685f561f8 (patch) | |
| tree | d1e7f3ab861685d2ee30e47f5e28e72fc079041f | |
| parent | okok (diff) | |
| download | hardflip-bf05941247867b6dd1f0532a1159e3b685f561f8.tar.gz hardflip-bf05941247867b6dd1f0532a1159e3b685f561f8.tar.bz2 hardflip-bf05941247867b6dd1f0532a1159e3b685f561f8.tar.xz hardflip-bf05941247867b6dd1f0532a1159e3b685f561f8.tar.zst hardflip-bf05941247867b6dd1f0532a1159e3b685f561f8.zip | |
fuck good
| -rw-r--r-- | src/c_exec.go | 22 | ||||
| -rw-r--r-- | src/c_fuzz.go | 2 | ||||
| -rw-r--r-- | src/c_hardflip.go | 2 | ||||
| -rw-r--r-- | src/c_utils.go | 3 | 
4 files changed, 17 insertions, 12 deletions
| diff --git a/src/c_exec.go b/src/c_exec.go index ff0ed89..f6d84ed 100644 --- a/src/c_exec.go +++ b/src/c_exec.go @@ -211,12 +211,14 @@ func c_format_cmd(host *HostNode, opts HardOpts,  		return nil, nil  	}  	if len(gpg) > 0 && gpg != "plain" && len(host.Pass) > 0 { -		i_draw_msg(ui.s, 1, ui.style[BOX_STYLE], ui.dim, " GnuPG ") -		text := "decryption using gpg..." -		left, right := i_left_right(len(text), *ui) -		i_draw_text(ui.s, left, ui.dim[H] - 3, right, ui.dim[H] - 3, -			ui.style[DEF_STYLE], text) -		ui.s.Show() +		if ui.s != nil { +			i_draw_msg(ui.s, 1, ui.style[BOX_STYLE], ui.dim, " GnuPG ") +			text := "decryption using gpg..." +			left, right := i_left_right(len(text), *ui) +			i_draw_text(ui.s, left, ui.dim[H] - 3, right, ui.dim[H] - 3, +				ui.style[DEF_STYLE], text) +			ui.s.Show() +		}  		var err error  		pass, err = c_decrypt_str(host.Pass)  		if err != nil { @@ -292,12 +294,12 @@ func c_exec(host *HostNode, opts HardOpts, ui *HardUI) {  	if host.Protocol == PROTOCOL_CMD {  		silent = host.Silent  	} -	if silent == false && ui != nil { +	if silent == false && ui.s != nil {  		if err := ui.s.Suspend(); err != nil {  			c_error_mode("screen", err, ui)  			return  		} -	} else if ui != nil { +	} else if ui.s != nil {  		i_draw_msg(ui.s, 1, ui.style[BOX_STYLE], ui.dim, " Exec ")  		text := "running command..." @@ -307,13 +309,13 @@ func c_exec(host *HostNode, opts HardOpts, ui *HardUI) {  		ui.s.Show()  	}  	if err, err_str := c_exec_cmd(cmd_fmt, cmd_env, silent); -	err != nil && host.Protocol == PROTOCOL_CMD { +	   err != nil && host.Protocol == PROTOCOL_CMD {  		c_error_mode(err_str, err, ui)  	}  	if opts.Loop == false {  		ui.s.Fini()  		os.Exit(0) -	} else if silent == false && ui != nil { +	} else if silent == false && ui.s != nil {  		c_resume_or_die(ui)  	}  } diff --git a/src/c_fuzz.go b/src/c_fuzz.go index e3ee16c..313b684 100644 --- a/src/c_fuzz.go +++ b/src/c_fuzz.go @@ -104,7 +104,7 @@ func c_fuzz(data *HardData, ui *HardUI) (bool) {  		return false  	}  	if err := search.Start(); err != nil { -		if ui != nil { +		if ui.s != nil {  			c_error_mode("fzf", err, ui)  			c_resume_or_die(ui)  			return false diff --git a/src/c_hardflip.go b/src/c_hardflip.go index ca5c5bb..bc072ed 100644 --- a/src/c_hardflip.go +++ b/src/c_hardflip.go @@ -82,7 +82,7 @@ func main() {  	data := c_init_hard(data_dir, n_arg, s_arg)  	if s_arg == true {  		if c_fuzz(data, &data.ui) == true { -			c_exec(data.litems.curr.Host, data.opts, nil) +			c_exec(data.litems.curr.Host, data.opts, &data.ui)  		}  		return  	} diff --git a/src/c_utils.go b/src/c_utils.go index 76ac248..2333ffd 100644 --- a/src/c_utils.go +++ b/src/c_utils.go @@ -149,6 +149,9 @@ func c_die(str string, err error) {  }  func c_error_mode(msg string, err error, ui *HardUI) { +	if ui == nil { +		return +	}  	ui.mode = ERROR_MODE  	err_str := ""  	if err != nil { | 
