package
1.73.0
Repository: https://github.com/arm-software/golang-utils.git
Documentation: pkg.go.dev

# Functions

AddGroup creates a group if not already existing.
AddUser adds a new user to the platform.
AssociateUserToGroup adds a user to a group.
BootTime returns system uptime.
ConvertError converts a platform error into a commonerrors.
ConvertUserGroupError converts errors related to users in common errors.
DefineSudoCommand defines the command to run to be `root` or a user with enough privileges (superuser).
DefineUser adds a new user to the platform.
DeleteUser removes a user from the platform when the user is specified using a `user.User` structure.
DissociateUserFromGroup removes a user from a group.
ExpandFromEnvironment expands a string containing variables with values from the environment.
ExpandParameter expands a variable expressed in a string `s` with its value returned by the mapping function.
ExpandUnixParameter expands a ${param} or $param in `s` based on the mapping function See https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html os.Expand is used under the bonnet and so, only basic parameter substitution is performed.
ExpandWindowsParameter expands a %param% in `s` based on the mapping function See https://learn.microsoft.com/en-us/previous-versions/troubleshoot/winautomation/product-documentation/best-practices/variables/percentage-character-usage-in-notations https://devblogs.microsoft.com/oldnewthing/20060823-00/?p=29993 https://github.com/golang/go/issues/24848 WARNING: currently the function only works with one parameter substitution in `s`.
GetCurrentUser returns information about the current platform's user and expands its home directory.
GetDefaultHomeDirectory returns the default home directory for a user based on the convention listed in https://en.wikipedia.org/wiki/Home_directory#Default_home_directory_per_operating_system.
GetHomeDirectory returns the home directory of a user.
No description provided by the author
GetUser returns information about a user and expands its home directory.
HasGroup checks whether a group exists.
HasUser checks whether a user exists.
Hostname returns the hostname.
IsAdmin states whether the user is a superuser or not.
IsCurrentUserAnAdmin states whether the current user is a superuser or not.
IsUserAdmin states whether the user is a superuser or not.
IsWindows checks whether we are running on Windows or not.
LineSeparator returns the line separator.
NodeName returns the system node name (equivalent to uname -n).
PlatformInformation returns the platform information (equivalent to uname -s).
RemoveGroup removes a group from the platform.
RemoveUser removes a user from the platform when only the username is known.
RemoveWithPrivileges removes a directory even if it is not owned by user (equivalent to sudo rm -rf).
SubstituteParameter performs parameter substitution on all platforms.
SubstituteParameterUnix performs Unix parameter substitution: See https://tldp.org/LDP/abs/html/parameter-substitution.html - the first element is the parameter to substitute - if find and replace is also wanted, pass the pattern and the replacement as following arguments in that order.
SubstituteParameterWindows performs Windows parameter substitution: See https://ss64.com/nt/syntax-replace.html - the first element is the parameter to substitute - if find and replace is also wanted, pass the pattern and the replacement as following arguments in that order.
SystemInformation returns the system information (equivalent to uname -a).
No description provided by the author
UnixLineSeparator returns the line separator on Unix platform.
UpTime returns system uptime.
WithPrivileges redefines a command so that it is run with elevated privileges.

# Constants

No description provided by the author
No description provided by the author

# Variables

IsUnixVariableName defines a validation rule for variable names on Unix for use with github.com/go-ozzo/ozzo-validation.
IsVariableName defines a validation rule for variable names for use with github.com/go-ozzo/ozzo-validation.
IsWindowsVariableName defines a validation rule for variable names on Windows for use with github.com/go-ozzo/ozzo-validation.
UnixVariableNameRegexString defines the schema for variable names on Unix.
WindowsVariableNameRegexString defines the schema for variable names on Windows.

# Structs

No description provided by the author

# Interfaces

No description provided by the author