gitui icon indicating copy to clipboard operation
gitui copied to clipboard

Tig-like command line arguments for startup mode

Open alexmaco opened this issue 3 years ago • 5 comments

Is your feature request related to a problem? Please describe. Sometimes I want to look at something specific, like a file blame or a branch view. Currently this means starting gitui and navigating to that state. This is redundant, especially when having to navigate to a file and open the blame view, instead of opening a blame from the terminal directly.

Describe the solution you'd like Some tig-like cli arguments:

  • blame <file_path> to directly open gitui in a file blame view
  • <refspec> to start with a log view at that refspec
  • stash to start with the stashes view

Describe alternatives you've considered Manually doing the navigation after opening gitui.

alexmaco avatar Oct 07 '22 12:10 alexmaco

Current master at least remembers the current tab. This functionality could be extended to remember more state of the current view

extrawurst avatar Oct 07 '22 21:10 extrawurst

This is a great tool. I would love to use it fulltime instead of gitk, especially for viewing file logs.

The startup friction is prohibitive, though, due to not yet having a command line interface for providing startup context.

I can type gitk somefile or gitk somecommit -- somefile. Or press Up to a command history entry containing somefile and then replace someprogram with gitk. Or launch them via an editor macro, etc. From my editor, it's two keystrokes to launch gitk on the current file. There's no in-built way to accomplish that with gitui.

I haven't looked at the code yet, but the UI makes it look like the internals are probably modular and probably wouldn't take much effort to initialize the UI state based on command line args, instead of manual input within the program.

Unfortunately, I haven't dabbled in Rust yet, so this isn't something I'll be able to contribute to soon.

chrisant996 avatar Oct 24 '22 07:10 chrisant996

This issue has been automatically marked as stale because it has not had any activity half a year. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 21 '23 11:05 stale[bot]

This is definitely the feature set I would need the most.

ShamrockLee avatar May 21 '23 19:05 ShamrockLee

This feature is very interesting and users could build plugins using it inside text editors (especially terminal based text editor like vim). With such feature it would be possible diff, blame, git history for the current open file and get a commit details from withing the text edit with tmux or other tools to provide a built-in terminal

@extrawurst I'm interesting in implementing this feature and it would be helpful to discuss its specs... At first we can think about the commands that we need to implement. Those are the commands I have in mind, we can extend them with other useful commands

  • file-diff <file-path>
  • file-history <file-path>
  • blame <file-path>
  • commit <commit-SHA>
  • stashes

Another point is to decide if we use sub-commands for them or make them as arguments:

  • We can introduce CLI sub-commands like gitui cmds diff <file-path> or directly like gitui diff_file <file-path>.
  • Another option is to provide them as arguments like gitui --diff_file <file_path> but this wouldn't be the best approach since the users can combine different commands at the same time this

AmmarAbouZor avatar Oct 19 '23 20:10 AmmarAbouZor