Let grut accept a file path, optionally with a line number, so you can jump straight into a file. Today grut [dir] only takes a directory. Accepting a file makes grut usable as the target of shell pipelines and quick jumps like grut internal/git/client.go:120.
Solution
When the positional argument points at a file, open grut rooted at the file's directory, select that file in the File Tree, focus the Preview panel, and scroll to the line when a :line suffix is present. Keep the existing directory behavior unchanged.
Acceptance criteria
grut path/to/file opens with that file selected and shown in the Preview panel.
grut path/to/file:42 additionally scrolls the preview to line 42.
- A trailing
:line on a path that does not exist is treated as part of the directory argument, matching current behavior.
- Passing a directory continues to work exactly as before.
- Unit tests cover the file-vs-directory argument parsing and the
:line suffix handling.
Let
grutaccept a file path, optionally with a line number, so you can jump straight into a file. Todaygrut [dir]only takes a directory. Accepting a file makes grut usable as the target of shell pipelines and quick jumps likegrut internal/git/client.go:120.Solution
When the positional argument points at a file, open grut rooted at the file's directory, select that file in the File Tree, focus the Preview panel, and scroll to the line when a
:linesuffix is present. Keep the existing directory behavior unchanged.Acceptance criteria
grut path/to/fileopens with that file selected and shown in the Preview panel.grut path/to/file:42additionally scrolls the preview to line 42.:lineon a path that does not exist is treated as part of the directory argument, matching current behavior.:linesuffix handling.