JetpackDuba / Gitnuro

A FOSS Git multiplatform client for newbies and pros
https://gitnuro.com/
GNU General Public License v3.0
869 stars 44 forks source link

command line parameters for opening repos #197

Open adam-ce opened 5 months ago

adam-ce commented 5 months ago

Is your feature request related to a problem? Please describe. I often work with many repositories of a similar name, e.g. student repos for their assignments, or various pull requests etc. In these cases, i don't want to keep these repos open in gitnuro. however, i often already have the repo open in the file manager or the console. and hence, i would like to start gitnuro for that repo.

Describe the solution you'd like

Describe alternatives you've considered file manager integration would have to be done for each system separately. but once you have the functionality described above, you can do it on your own.

JetpackDuba commented 5 months ago

That should already be working unless you are using the Flatpak version, which has an open issue about it.

adam-ce commented 5 months ago

interesting, yes, i'm using flatpak. could you point to the bug?

I tried the jar now and it doesn't try to open the working directory as a repo, but that's easy to workaround with a custom start script.

The jar version also opens the same repo several times in separate tabs. i would expect, that it would just switch to the tab if it already exists. image

JetpackDuba commented 5 months ago

Yes, it's something kinda intentional because under some circumastances having a repo opened twice can be useful.

The flatpak issue is this https://github.com/flathub/com.jetpackduba.Gitnuro/issues/11 I forgot about it until recently, I have tried to fix the script but no much luck yet. I'll probably try again before the next release.

adam-ce commented 5 months ago

okey, fair enough :)

would be cool if you could put some command line options there to customise the behaviour. in the future this could serve e.g. for opening specific sessions etc.

also, there is no gitnuro --version or --help :)

adam-ce commented 5 months ago

I edited the title and description

adam-ce commented 5 months ago

not sure where to put it, but gitnuro is currently not able to open repositories from within a subdir.

with git it's easy to find out whether you are in a subdir. so as a workaround i'm using this bash script:

#!/bin/bash

if [ $# -gt 0 ]; then
    java -jar ~/bin/Gitnuro.jar $(cd $1 && git rev-parse --show-toplevel)
elif git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
    java -jar ~/bin/Gitnuro.jar "$(git rev-parse --show-toplevel)"
else
    java -jar ~/bin/Gitnuro.jar
fi