mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-11-24 16:53:14 +08:00
* 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
37 lines
567 B
Go
37 lines
567 B
Go
package shell
|
|
|
|
import (
|
|
"fmt"
|
|
"io"
|
|
)
|
|
|
|
func init() {
|
|
Commands = append(Commands, &commandFsPwd{})
|
|
}
|
|
|
|
type commandFsPwd struct {
|
|
}
|
|
|
|
func (c *commandFsPwd) Name() string {
|
|
return "fs.pwd"
|
|
}
|
|
|
|
func (c *commandFsPwd) Help() string {
|
|
return `print out current directory`
|
|
}
|
|
|
|
func (c *commandFsPwd) HasTag(CommandTag) bool {
|
|
return false
|
|
}
|
|
|
|
func (c *commandFsPwd) Do(args []string, commandEnv *CommandEnv, writer io.Writer) (err error) {
|
|
|
|
if handleHelpRequest(c, args, writer) {
|
|
return nil
|
|
}
|
|
|
|
fmt.Fprintf(writer, "%s\n", commandEnv.option.Directory)
|
|
|
|
return nil
|
|
}
|