Description
Description
I like using the scope
descriptor to see which files a commit is altering
If I commit a single file, it would be nice to have the option to auto-fill the 'scope' dialogue with the name of that file, relative to the root directory.
e.g. if I were to do this:
// in root dir on a clean worktree
$ touch some_dir/some.file
$ git add .
$ cz c
I would expect the cz c
dialogue to pop-up, where I can choose fix/feat etc., then when I am asked 'What is the scope of this change?' I would expect the text input to be prefilled with some.file
, so I can change it to something else, or just hit enter to continue.
This would not be applicable if a commit contains multiple files, as a file-based scope doesn't make sense there, so I would expect the scope field to be left blank in that case.
Possible Solution
Add a boolean
option prefill_scope_for_single_files
that defualts to false
and when set to true
, makes the CLI tool scan for the number of files that have changed upon asking the scope question.
If the number of files is one, grab the filename and pre-fill it as the scope.
Optional: add boolean
opt prefill_scope_for_single_files_relative
that defaults to false
and determines whether the scope should be prefilled with some.file
(when opt is false
) or some_dir/some.file
(when opt is true
)
Additional context
This would have to be an opt-in feature for sure as some people skip the scope step.