func IsEnabled(ctx context.Context, unit string, opts Options) (bool, error) {
	var args = []string{"is-enabled", "--system", unit}
	if opts.UserMode {
		args[1] = "--user"
	}
	stdout, _, _, err := execute(ctx, args)
	stdout = strings.TrimSuffix(stdout, "\n")
	switch stdout {
	case "enabled":
		return true, nil
	case "enabled-runtime":
		return true, nil
	case "linked":
		return false, ErrLinked
	case "linked-runtime":
		return false, ErrLinked
	case "alias":
		return true, nil
	case "masked":
		return false, ErrMasked
	case "masked-runtime":
		return false, ErrMasked
	case "static":
		return true, nil
	case "indirect":
		return true, nil
	case "disabled":
		return false, nil
	case "generated":
		return true, nil
	case "transient":
		return true, nil
	}
	if err != nil {
		return false, err
	}
	return false, ErrUnspecified
}
// Checks whether any of the specified unit files are enabled (as with enable).
//
// Returns true if the unit is enabled, aliased, static, indirect, generated
// or transient.
//
// Returns false if disabled. Also returns an error if linked, masked, or bad.
//
// See https://www.freedesktop.org/software/systemd/man/systemctl.html#is-enabled%20UNIT%E2%80%A6
// for more information
Checks whether any of the specified unit files are enabled (as with enable).

Returns true if the unit is enabled, aliased, static, indirect, generated
or transient.

Returns false if disabled. Also returns an error if linked, masked, or bad.


// Checks whether any of the specified unit files are enabled ( as with enable ) . // // Returns true if the unit is enabled aliased static indirect generated // or transient . // // Returns false if disabled . Also returns an error if linked masked or bad . // // See https : // www . freedesktop . org / software / systemd / man / systemctl . html#is - enabled%20UNIT%E2%80%A6 // for more information
func IsEnabled(ctx context.Context, unit string, opts Options) (bool, error) {
	var args = []string{"is-enabled", "--system", unit}
	if opts.UserMode {
		args[1] = "--user"
	}
	stdout, _, _, err := execute(ctx, args)
	stdout = strings.TrimSuffix(stdout, "\n")
	switch stdout {
	case "enabled":
		return true, nil
	case "enabled-runtime":
		return true, nil
	case "linked":
		return false, ErrLinked
	case "linked-runtime":
		return false, ErrLinked
	case "alias":
		return true, nil
	case "masked":
		return false, ErrMasked
	case "masked-runtime":
		return false, ErrMasked
	case "static":
		return true, nil
	case "indirect":
		return true, nil
	case "disabled":
		return false, nil
	case "generated":
		return true, nil
	case "transient":
		return true, nil
	}
	if err != nil {
		return false, err
	}
	return false, ErrUnspecified
}
func IsEnabled ( ctx context . Context , unit string , opts Options ) ( bool , error ) { var args = [ ] string { " " , " " , unit } if opts . UserMode { args [ 1 ] = " " } stdout , _ , _ , err := execute ( ctx , args ) stdout = strings . TrimSuffix ( stdout , " \n " ) switch stdout { case " " : return true , nil case " " : return true , nil case " " : return false , ErrLinked case " " : return false , ErrLinked case " " : return true , nil case " " : return false , ErrMasked case " " : return false , ErrMasked case " " : return true , nil case " " : return true , nil case " " : return false , nil case " " : return true , nil case " " : return true , nil } if err != nil { return false , err } return false , ErrUnspecified }
Checks whether any of the specified unit files are enabled (as with enable).
Checks whether any of the specified unit files are enabled ( as with enable ) .