aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjoe <rbo@gmx.us>2025-08-29 17:23:08 +0200
committerjoe <rbo@gmx.us>2025-08-29 17:23:08 +0200
commit06549448c8e0c2e499bd12001b4ec56ba3752d89 (patch)
treeccee025bec7bd254ae2c4c31703f17d3c4d0b504
parentfuck good (diff)
downloadhardflip-06549448c8e0c2e499bd12001b4ec56ba3752d89.tar.gz
hardflip-06549448c8e0c2e499bd12001b4ec56ba3752d89.tar.bz2
hardflip-06549448c8e0c2e499bd12001b4ec56ba3752d89.tar.xz
hardflip-06549448c8e0c2e499bd12001b4ec56ba3752d89.tar.zst
hardflip-06549448c8e0c2e499bd12001b4ec56ba3752d89.zip
fzf bin plus fix bad behaviour
-rw-r--r--Makefile2
-rw-r--r--README.md9
-rw-r--r--conf/config.sample.yml6
-rw-r--r--man/hf.153
-rw-r--r--src/c_defs.go1
-rw-r--r--src/c_fuzz.go12
-rw-r--r--src/c_init.go3
-rw-r--r--src/c_parse.go4
8 files changed, 73 insertions, 17 deletions
diff --git a/Makefile b/Makefile
index a347df2..88597ab 100644
--- a/Makefile
+++ b/Makefile
@@ -27,7 +27,7 @@ DEST := /usr
.DEFAULT_GOAL := ${TARGET}
run: ${SRC}
- go run ${SRC_DIR} -s
+ go run ${SRC_DIR}
${TARGET}: ${SRC}
go build -o ${TARGET} ${SRC_DIR}
diff --git a/README.md b/README.md
index 1c9a3fa..5bbc145 100644
--- a/README.md
+++ b/README.md
@@ -15,6 +15,7 @@ Install those if you need them:
+ `gpg` to crypt passwords, similarily to
[pass](https://www.passwordstore.org/). You can store them in plain text if you
prefer but I wouldn't recommend that option
++ `fzf`
+ `go`
+ GNU `make`
@@ -89,6 +90,8 @@ that, it doesn't work at all, just leave that unset
entered by default when adding a new SSH host or jump, saving a ton of time.
Of course it can be changed when adding the host. Leave empty if you don't have
a main key
++ `fuzzy_finder`: (`string`) custom path for the fuzzy search program. For you
+`skim` nerds. Defaults to `fzf` if not set
### `colors.yml`
@@ -140,9 +143,13 @@ keys, maybe in the future.
On first start, you will be prompted to configure GnuPG and default SSH keys.
+### Options
+
+`man hf` for more infos.
+
## Next
-Check `ROADMAP.md` to see the intended upgrades for `hardflip`. VNC hosts and
+Check [ROADMAP.md](ROADMAP.md) to see the intended upgrades for `hardflip`. VNC hosts and
fuzzysearch are big ones. But that's pretty much it. Enjoy.
## Bugs
diff --git a/conf/config.sample.yml b/conf/config.sample.yml
index d80eb1d..45cfd1a 100644
--- a/conf/config.sample.yml
+++ b/conf/config.sample.yml
@@ -19,5 +19,9 @@ percent: false
# the command will replace hardflip
#terminal: alacritty
-# this will be entered by default when adding a new SSH or SSH jump host
+# this will be entered by default when adding a new SSH or SSH jump host to win
+# some time
default_ssh_priv: path/to/key
+
+# fuzzy finder program used in search (keybind /) and -s mode
+#fuzzy_finder: fzf
diff --git a/man/hf.1 b/man/hf.1
index 6f21d20..ecb0959 100644
--- a/man/hf.1
+++ b/man/hf.1
@@ -1,6 +1,6 @@
.\" Manpage for hf
.\" Contact rbo@gmx.us to correct errors and typos.
-.TH hf 1 "20 May 2024" "hf 1.0" "hardflip Reference"
+.TH hf 1 "28 August 2025" "hf 1.0" "hardflip Reference"
.SH NAME
hf \- super fast remote connection manager
.SH SYNOPSYS
@@ -14,11 +14,26 @@ Passwords are stored using \fBGnuPG\fR keys or plaintext (depending on your
setup).
.SH OPTIONS
.TP
-\fB\-h\fR, \fB\-\-help\fR
-Prints the help
+\fB\-h\fR
+prints the usage and exit
.TP
-\fB\-v\fR, \fB\-\-version\fR
-Prints the program version
+\fB\-n\fR
+disables loop mode, ignoring the \fBloop\fR setting from
+.IR config.yml .
+See
+.B CONFIGURATION
+.TP
+\fB\-s\fR
+starts in search mode using
+.IR fzf (1).
+The program will not run the TUI and search directly through the existing hosts.
+Contrary to search mode from within the TUI, selecting an host will execute
+the configuration directly. Using this option will exit the program at the end
+of the session or if the search was cancelled. This option implies \fB\-n\fR.
+.IR config.yml .
+.TP
+\fB\-v\fR
+prints the program version and exit
.SH CONFIGURATION
.BR hf
stores its configuration files in the
@@ -33,46 +48,68 @@ Here are some options:
.TP
.BR icons :
.I bool
+.RS 4
shows or not icons
+.RE
.TP
.BR loop :
.I bool
+.RS 4
the program will run again after exiting the host you connected to
+.RE
.TP
.BR gpg :
.I string
+.RS 4
the gpg key ID you set at first boot. It is used to encrypt passwords. If set
to **"plain"**, passwords will be stored in plaintext. I don't recommend this
at all but you might not care
+.RE
.TP
.BR percent :
.I bool
+.RS 4
shows percent of hosts the cursor is on in the bottom right of the window
+.RE
.TP
.BR terminal :
.I string
+.RS 4
will spawn the command to connect to your host in a new instance of your set
terminal. It was intended to open the connection in a new terminal in the
background, allowing you to still be using the same
.B hf
while connected to one or several of your hosts. Turns out I can't code that, it
doesn't work at all, just leave that unset
+.RE
.TP
.BR default_ssh_priv :
.I string
+.RS 4
default SSH private key path. It will be entered by default when adding a new
SSH host or jump, saving a ton of time. Of course it can be changed when adding
the host. Leave empty if you don't have a main key
+.RE
+.TP
+.BR fuzzy_finder :
+.I string
+.RS 4
+custom path for the fuzzy search program. For you
+.IR skim
+nerds. Defaults to
+.IR fzf
+if not set
+.RE
.SH BUGS
Please note that
.B hardflip
-was tested only on Linux and FreeBSD at the moment. This is probably full of
+was only tested on Linux and FreeBSD at the moment. This is probably full of
bugs, so please report any bug to me,
-.IR "Joe <rbo@gmx.us>"
+.IR "joe <rbo@gmx.us>"
or on GitHub at
.IR https://github.com/JozanLeClerc/hardflip .
.SH AUTHOR
-Joe <rbo@gmx.us>
+joe <rbo@gmx.us>
.SH SEE ALSO
.IR ssh (1),
.IR xfreerdpd (1),
diff --git a/src/c_defs.go b/src/c_defs.go
index fc6c4c2..cc8a42f 100644
--- a/src/c_defs.go
+++ b/src/c_defs.go
@@ -240,6 +240,7 @@ var DEFAULT_OPTS = HardOpts{
false,
"",
"",
+ "fzf",
"",
}
diff --git a/src/c_fuzz.go b/src/c_fuzz.go
index 313b684..5dd7880 100644
--- a/src/c_fuzz.go
+++ b/src/c_fuzz.go
@@ -98,24 +98,30 @@ func c_fuzz(data *HardData, ui *HardUI) (bool) {
return false
}
}
- search := exec.Command("fzf")
+ search := exec.Command(data.opts.Fuzzer)
stdin, stdout := c_fuzz_init_pipes(ui, search)
if stdin == nil || stdout == nil {
return false
}
if err := search.Start(); err != nil {
if ui.s != nil {
- c_error_mode("fzf", err, ui)
+ c_error_mode("fuzzy finder", err, ui)
c_resume_or_die(ui)
return false
} else {
- c_die("fzf", err)
+ c_die("fuzzy finder", err)
}
}
go func() {
defer stdin.Close()
for ptr := data.litems.head; ptr != nil; ptr = ptr.next {
if ptr.is_dir() == true {
+ // } else if data.litems.curr.Dirs != nil &&
+ // data.folds[data.litems.curr.Dirs] == nil {
+ // e_fold_dir(data, data.litems.curr)
+ // } else {
+ // e_unfold_dir(data, data.litems.curr)
+ // }
continue
}
io.WriteString(stdin, ptr.path()[1:] + ptr.Host.Name + "\n")
diff --git a/src/c_init.go b/src/c_init.go
index c2c7779..555fb96 100644
--- a/src/c_init.go
+++ b/src/c_init.go
@@ -66,6 +66,7 @@ type HardOpts struct {
Perc bool `yaml:"percent"`
Term string `yaml:"terminal"`
DefSSH string `yaml:"default_ssh_priv"`
+ Fuzzer string `yaml:"fuzzy_finder"`
file string
}
@@ -185,7 +186,7 @@ func c_get_options(dir string, load_err *[]error) HardOpts {
opts.file = file
return opts
}
- opts, err := c_parse_opts(file)
+ opts, err := c_parse_opts(file, opts)
opts.file = file
if err != nil {
*load_err = append(*load_err, err)
diff --git a/src/c_parse.go b/src/c_parse.go
index 5f788e9..2b5950f 100644
--- a/src/c_parse.go
+++ b/src/c_parse.go
@@ -59,8 +59,8 @@ import (
"gopkg.in/yaml.v3"
)
-func c_parse_opts(file string) (HardOpts, error) {
- var opts HardOpts
+func c_parse_opts(file string, defaults HardOpts) (HardOpts, error) {
+ opts := defaults
yaml_file, err := os.ReadFile(file)
if err != nil {