denisidoro / navi

An interactive cheatsheet tool for the command-line
Apache License 2.0
15.22k stars 507 forks source link

Non-Interactive Cheatsheet Install #863

Closed jfmercer closed 10 months ago

jfmercer commented 12 months ago

How do I do a non-interactive install of my cheatsheets? When I run yes | navi repo add denisidoro/cheats, I still get the interactive prompt. I have not succeeded in write an expect to automate this.

Any ideas? I'm happy to contribute to navi's documentation if there is a solution.

Thanks.

welcome[bot] commented 12 months ago

Thanks for opening your first issue here! In case you're facing a bug, please update navi to the latest version first. Maybe the bug is already solved! :)

davidandreoletti commented 10 months ago

@denisidoro (ping)

davidandreoletti commented 10 months ago

Workaround until an application native solution comes along:

f_navi_install_repo() {
    local url="$1"
    local name="$2"

    local cheatpath="$(navi info cheats-path)"
    local dir="$cheatpath/$name"

    git -C "$dir" pull || git clone "$url" "$dir"

}

#navi repo add denisidoro/navi-tldr-pages
f_navi_install_repo "https://github.com/denisidoro/navi-tldr-pages" "denisidoro__navi-tldr-pages"

then navi will display the cheats :-)

denisidoro commented 10 months ago

Yeah, the workaround is so simple that I'd rather not implement it as a feature in navi itself. I'll close this ticket as the workaround is good enough.

davidandreoletti commented 10 months ago

@denisidoro

It is so simple, I wonder why it was not bake in navi ;-)

navi already acts as a "cheatsheet" repo manager.

The workaround relies on:

Would you consider documenting the workaround as (a) official procedure OR (b) bake the functionality in navi itself ?

denisidoro commented 10 months ago

I guess Navi could skip the call to fzf in this case and optimistically assume the value which makes the most sense in this case.

I can't give an ETA for implementing it, though.

If someone submits a PR for it, I can review it and ensure it's going to be live in the next release.