mirror of
https://github.com/taigrr/systemctl.git
synced 2026-03-09 00:14:38 -07:00
feat: add optional variadic args to all commands (#8)
Allow callers to pass additional systemctl flags (e.g. --no-block, --force) via variadic string args on every exported function. This is backward-compatible: existing callers without extra args continue to work unchanged. Introduces a prepareArgs helper to centralize argument construction, replacing the duplicated args/UserMode pattern across all functions. Closes #2
This commit is contained in:
@@ -13,10 +13,10 @@ import (
|
||||
|
||||
func TestErrorFuncs(t *testing.T) {
|
||||
errFuncs := []func(ctx context.Context, unit string, opts Options) error{
|
||||
Enable,
|
||||
Disable,
|
||||
Restart,
|
||||
Start,
|
||||
func(ctx context.Context, unit string, opts Options) error { return Enable(ctx, unit, opts) },
|
||||
func(ctx context.Context, unit string, opts Options) error { return Disable(ctx, unit, opts) },
|
||||
func(ctx context.Context, unit string, opts Options) error { return Restart(ctx, unit, opts) },
|
||||
func(ctx context.Context, unit string, opts Options) error { return Start(ctx, unit, opts) },
|
||||
}
|
||||
errCases := []struct {
|
||||
unit string
|
||||
|
||||
Reference in New Issue
Block a user