Shell: Added a helper function isHelpRequest() (#7380)

* Added a helper function `isHelpRequest()`

* also handles combined short flags like -lh or -hl

* Created handleHelpRequest() helper function

encapsulates both:
Checking for help flags
Printing the help message

* Limit to reasonable length (2-4 chars total) to avoid matching long options like -verbose
This commit is contained in:
Chris Lu
2025-10-24 20:21:35 -07:00
committed by GitHub
parent 922bb17194
commit 37af41fbfe
12 changed files with 87 additions and 7 deletions

View File

@@ -36,6 +36,10 @@ func (c *commandFsMetaNotify) HasTag(CommandTag) bool {
func (c *commandFsMetaNotify) Do(args []string, commandEnv *CommandEnv, writer io.Writer) (err error) {
if handleHelpRequest(c, args, writer) {
return nil
}
path, err := commandEnv.parseUrl(findInputDirectory(args))
if err != nil {
return err