Documentation
¶
Overview ¶
Example ¶
Example tests if help is is parsed properly
// Save the original osExit
origExit := osExit
defer func() { osExit = origExit }()
// Override with a fake exit
// var exitCode int
osExit = func(code int) {
_ = code
}
// Save the original arguments
origArgs := os.Args
defer func() { os.Args = origArgs }()
// Override with our input
os.Args = []string{"sofcat.exe", "--help"}
// Run code, ignoring the return values
_, _, _, _ = parseArguments()
Output: unknown unknown SofCat - Munki-like Application Management for Windows https://github.com/hurricanehrndz/sofcat Usage: sofcat.exe [options] Options: -c, -config path to configuration file in yaml format -C, -checkonly enable check only mode -v, -verbose enable verbose output -d, -debug enable debug output -a, -about displays the version number and other build info -V, -version display the version number -s, -service run SofCat as a Windows service -S, -servicecmd send a command to a running SofCat service (GetServiceInfo|ListOptionalInstalls|GetBranding|InstallItem:itemName|RemoveItem:itemName|StreamOperationStatus:operationId|CancelOperation:operationId) -serviceinstall install SofCat as a Windows service and restrict its data directory to SYSTEM and Administrators -serviceremove remove SofCat Windows service -servicestart start SofCat Windows service -servicestop stop SofCat Windows service -servicestatus show SofCat Windows service status -h, -help display this help message
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Branding ¶
type Branding struct {
Title string `yaml:"title,omitempty"`
Tagline string `yaml:"tagline,omitempty"`
Logo string `yaml:"logo,omitempty"`
HelpURL string `yaml:"help_url,omitempty"`
HelpLabel string `yaml:"help_label,omitempty"`
Accent string `yaml:"accent,omitempty"`
}
Branding is the optional organisation branding block for SofCat UI. Policy registry values override it per field; pkg/branding merges and validates both.
type Configuration ¶
type Configuration struct {
URL string `yaml:"url"`
URLPackages string `yaml:"url_packages"`
Manifest string `yaml:"manifest"`
LocalManifests []string `yaml:"local_manifests,omitempty"`
Catalogs []string `yaml:"catalogs"`
AppDataPath string `yaml:"app_data_path"`
Verbose bool `yaml:"verbose,omitempty"`
Debug bool `yaml:"debug,omitempty"`
LogFilePlain bool `yaml:"log_file_plain,omitempty"`
CheckOnly bool `yaml:"checkonly,omitempty"`
AuthUser string `yaml:"auth_user,omitempty"`
AuthPass string `yaml:"auth_pass,omitempty"`
TLSAuth bool `yaml:"tls_auth,omitempty"`
TLSClientCert string `yaml:"tls_client_cert,omitempty"`
TLSClientKey string `yaml:"tls_client_key,omitempty"`
TLSServerCert string `yaml:"tls_server_cert,omitempty"`
CachePath string
ServiceMode bool `yaml:"service_mode,omitempty"`
ServiceCommand string
ServiceInstall bool
ServiceRemove bool
ServiceStart bool
ServiceStop bool
ServiceStatus bool
ServiceName string `yaml:"service_name,omitempty"`
ServiceInterval string `yaml:"service_interval,omitempty"`
ServicePipeName string `yaml:"service_pipe_name,omitempty"`
Branding Branding `yaml:"branding,omitempty"`
ConfigPath string
// RequestedBy maps a self-service item to the user whose request the run
// is carrying out, for the inventory. The service sets it per run; it is
// never read from config.yaml.
RequestedBy map[string]string `yaml:"-"`
}
Configuration stores all of the possible parameters a config file could contain
func Get ¶
func Get() Configuration
Get retrieves and parses the config file and returns a Configuration struct and any errors