mirror of
https://github.com/rclone/rclone.git
synced 2024-11-23 02:01:25 +08:00
bff702a6f1
This adds an additional parameter to the creation of each flag. This specifies one or more flag groups. This **must** be set for global flags and **must not** be set for local flags. This causes flags.md to be built with sections to aid comprehension and it causes the documentation pages for each command (and the `--help`) to be built showing the flags groups as specified in the `groups` annotation on the command. See: https://forum.rclone.org/t/make-docs-for-mortals-not-only-rclone-gurus/39476/
22 lines
879 B
Go
22 lines
879 B
Go
//go:build linux || darwin || freebsd
|
|
// +build linux darwin freebsd
|
|
|
|
package vfsflags
|
|
|
|
import (
|
|
"github.com/rclone/rclone/fs/config/flags"
|
|
"github.com/spf13/pflag"
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
// add any extra platform specific flags
|
|
func platformFlags(flagSet *pflag.FlagSet) {
|
|
Opt.Umask = unix.Umask(0) // read the umask
|
|
unix.Umask(Opt.Umask) // set it back to what it was
|
|
flags.IntVarP(flagSet, &Opt.Umask, "umask", "", Opt.Umask, "Override the permission bits set by the filesystem (not supported on Windows)", "VFS")
|
|
Opt.UID = uint32(unix.Geteuid())
|
|
Opt.GID = uint32(unix.Getegid())
|
|
flags.Uint32VarP(flagSet, &Opt.UID, "uid", "", Opt.UID, "Override the uid field set by the filesystem (not supported on Windows)", "VFS")
|
|
flags.Uint32VarP(flagSet, &Opt.GID, "gid", "", Opt.GID, "Override the gid field set by the filesystem (not supported on Windows)", "VFS")
|
|
}
|