From 455e395cb8dff5d9b009168ca60faf2b520f41df Mon Sep 17 00:00:00 2001 From: Jahvon Dockery Date: Sun, 13 Oct 2024 15:21:34 -0400 Subject: [PATCH] fix: split verbs into proper synonym groups --- docs/cli/flow_library.md | 2 +- docs/cli/flow_library_glance.md | 2 +- docs/schemas/flowfile_schema.json | 72 ++++++-- docs/types/flowfile.md | 136 +++++++++++---- types/executable/executable.gen.go | 48 +++++- types/executable/executable_schema.yaml | 163 +++++++++++++++--- types/executable/ref.go | 214 ++++++++++++++---------- 7 files changed, 480 insertions(+), 157 deletions(-) diff --git a/docs/cli/flow_library.md b/docs/cli/flow_library.md index 5e6dbcc..2f84687 100644 --- a/docs/cli/flow_library.md +++ b/docs/cli/flow_library.md @@ -14,7 +14,7 @@ flow library [flags] -h, --help help for library -n, --namespace string Filter executables by namespace. -t, --tag stringArray Filter by tags. - -v, --verb string Filter executables by verb. One of: [activate add analyze apply audit build bundle check clean clear configure create deactivate delete deploy destroy disable edit enable exec generate init install kill launch lint manage new open package patch publish purge push reboot refresh release reload remove render restart run scan send set setup show start stop teardown test transform undeploy uninstall unset update upgrade validate verify view watch] + -v, --verb string Filter executables by verb. One of: [abort activate add analyze apply build bundle check clean clear compile create deactivate delete deploy destroy disable enable erase exec execute fetch generate get init inspect install kill launch lint monitor new open package pause publish purge push reboot refresh release reload remove request reset restart retrieve run scan send set setup show start stop teardown terminate test tidy track trigger undeploy uninstall unset validate verify view watch] -w, --workspace string Filter executables by workspace. ``` diff --git a/docs/cli/flow_library_glance.md b/docs/cli/flow_library_glance.md index 4ec7335..3730445 100644 --- a/docs/cli/flow_library_glance.md +++ b/docs/cli/flow_library_glance.md @@ -15,7 +15,7 @@ flow library glance [flags] -n, --namespace string Filter executables by namespace. -o, --output string Output format. One of: yaml, json, doc, or list. -t, --tag stringArray Filter by tags. - -v, --verb string Filter executables by verb. One of: [activate add analyze apply audit build bundle check clean clear configure create deactivate delete deploy destroy disable edit enable exec generate init install kill launch lint manage new open package patch publish purge push reboot refresh release reload remove render restart run scan send set setup show start stop teardown test transform undeploy uninstall unset update upgrade validate verify view watch] + -v, --verb string Filter executables by verb. One of: [abort activate add analyze apply build bundle check clean clear compile create deactivate delete deploy destroy disable enable erase exec execute fetch generate get init inspect install kill launch lint monitor new open package pause publish purge push reboot refresh release reload remove request reset restart retrieve run scan send set setup show start stop teardown terminate test tidy track trigger undeploy uninstall unset validate verify view watch] -w, --workspace string Filter executables by workspace. ``` diff --git a/docs/schemas/flowfile_schema.json b/docs/schemas/flowfile_schema.json index 3e34866..79e3728 100644 --- a/docs/schemas/flowfile_schema.json +++ b/docs/schemas/flowfile_schema.json @@ -502,40 +502,86 @@ } }, "ExecutableVerb": { - "description": "Keywords that describe the action an executable performs.\nWhile executables are configured with a single verb, the verb can be aliased to related verbs.\nFor example, the `exec` verb can replaced with \"run\" or \"start\" when referencing an executable.\nThis allows users to use the verb that best describes the action they are performing.\n\n- **Activation verbs**: `exec`, `run`, `start`, `activate`, `enable`, `watch`\n- **Deactivation verbs**: `deactivate`, `disable`, `stop`, `kill`\n- **Restart verbs**: `restart`, `reboot`, `reload`, `refresh`\n- **Install verbs**: `install`, `setup`, `build`, `package`, `bundle`\n- **Uninstall verbs**: `uninstall`, `teardown`, `undeploy`\n- **Update verbs**: `update`, `upgrade`, `patch`, `edit`, `transform`, `manage`, `configure`\n- **Publish verbs**: `publish`, `release`, `deploy`, `apply`, `push`, `send`\n- **Management verbs**: `manage`, `configure`, `monitor`, `edit`\n- **Test verbs**: `test`, `validate`, `check`, `verify`\n- **Analyze verbs**: `analyze`, `scan`, `lint`, `audit`\n- **Launch verbs**: `open`, `launch`, `show`, `view`, `render`\n- **Creation verbs**: `generate`, `add`, `new`, `create`, `init`, `set`\n- **Destruction verbs**: `remove`, `delete`, `unset`, `destroy`, `clean`, `clear`, `purge`\n\n[Verb group + Name] must be unique within the namespace of the workspace.\n", + "description": "Keywords that describe the action an executable performs. While executables are configured with a single verb, \nthe verb can be aliased to related verbs within its group. For example, the `activate` verb can be replaced \nwith \"enable\" or \"start\" when referencing an executable. This allows users to use the verb that best describes \nthe action they are performing.\n\n### Verb Groups\n\n- **Activation Group**: `activate`, `enable`, `start`, `trigger`\n- **Execution Group**: `exec`, `run`, `execute`\n- **Deactivation Group**: `deactivate`, `disable`, `stop`, `pause`\n- **Termination Group**: `kill`, `terminate`, `abort`\n- **Monitoring Group**: `watch`, `monitor`, `track`\n- **Restart Group**: `restart`, `reboot`, `reload`, `refresh`\n- **Installation Group**: `install`, `setup`, `deploy`\n- **Build Group**: `build`, `package`, `bundle`, `compile`\n- **Uninstallation Group**: `uninstall`, `teardown`, `undeploy`\n- **Update Group**: `update`, `upgrade`, `patch`\n- **Configuration Group**: `configure`, `manage`\n- **Edit Group**: `edit`, `transform`, `modify`\n- **Publish Group**: `publish`, `release`\n- **Distribution Group**: `push`, `send`, `apply`\n- **Test Group**: `test`, `validate`, `check`, `verify`\n- **Analysis Group**: `analyze`, `scan`, `lint`, `inspect`\n- **Launch Group**: `open`, `launch`, `show`, `view`\n- **Creation Group**: `create`, `generate`, `add`, `new`, `init`\n- **Set Group**: `set`\n- **Destruction Group**: `remove`, `delete`, `destroy`, `erase`\n- **Unset Group**: `unset`, `reset`\n- **Cleanup Group**: `clean`, `clear`, `purge`, `tidy`\n- **Retrieval Group**: `retrieve`, `fetch`, `get`, `request`\n\n### Usage Notes\n\n1. [Verb group + Name] must be unique within the namespace of the workspace.\n2. When referencing an executable, users can use any verb from the appropriate group.\n3. Choose the verb that most accurately describes the action being performed.\n4. Be consistent in verb usage within projects or teams to maintain clarity.\n\n### Examples\n\n- An executable configured with the `activate` verb could also be referenced using \"enable\" or \"start\".\n- A build process might use `build` as its primary verb, but could also be invoked with \"package\" or \"assemble\".\n- A cleanup routine configured with `clean` could be called using \"purge\" or \"sanitize\" for more specific connotations.\n \nBy organizing verbs into these groups, flow provides flexibility in how actions are described while maintaining a \nclear structure for executable operations.\n", "type": "string", "default": "exec", "enum": [ + "activate", + "enable", + "start", + "trigger", "exec", "run", - "start", + "execute", + "deactivate", + "disable", + "stop", + "pause", + "kill", + "terminate", + "abort", + "watch", + "monitor", + "track", + "restart", + "reboot", + "reload", + "refresh", "install", "setup", - "release", "deploy", - "apply", - "delete", + "build", + "package", + "bundle", + "compile", "uninstall", - "destroy", + "teardown", "undeploy", "update", "upgrade", - "refresh", - "reload", - "manage", + "patch", "configure", - "monitor", + "manage", "edit", + "transform", + "modify", + "publish", + "release", + "push", + "send", + "apply", + "test", + "validate", + "check", + "verify", + "analyze", + "scan", + "lint", + "inspect", "open", "launch", "show", "view", - "render", + "create", "generate", "add", "new", - "build", - "transform" + "init", + "set", + "remove", + "delete", + "destroy", + "erase", + "unset", + "reset", + "clean", + "clear", + "purge", + "tidy", + "retrieve", + "fetch", + "get", + "request" ] }, "FromFile": { diff --git a/docs/types/flowfile.md b/docs/types/flowfile.md index 31263ea..27cc9c1 100644 --- a/docs/types/flowfile.md +++ b/docs/types/flowfile.md @@ -368,61 +368,133 @@ A list of executables to run in serial. The executables can be defined by it's e ### ExecutableVerb -Keywords that describe the action an executable performs. -While executables are configured with a single verb, the verb can be aliased to related verbs. -For example, the `exec` verb can replaced with "run" or "start" when referencing an executable. -This allows users to use the verb that best describes the action they are performing. - -- **Activation verbs**: `exec`, `run`, `start`, `activate`, `enable`, `watch` -- **Deactivation verbs**: `deactivate`, `disable`, `stop`, `kill` -- **Restart verbs**: `restart`, `reboot`, `reload`, `refresh` -- **Install verbs**: `install`, `setup`, `build`, `package`, `bundle` -- **Uninstall verbs**: `uninstall`, `teardown`, `undeploy` -- **Update verbs**: `update`, `upgrade`, `patch`, `edit`, `transform`, `manage`, `configure` -- **Publish verbs**: `publish`, `release`, `deploy`, `apply`, `push`, `send` -- **Management verbs**: `manage`, `configure`, `monitor`, `edit` -- **Test verbs**: `test`, `validate`, `check`, `verify` -- **Analyze verbs**: `analyze`, `scan`, `lint`, `audit` -- **Launch verbs**: `open`, `launch`, `show`, `view`, `render` -- **Creation verbs**: `generate`, `add`, `new`, `create`, `init`, `set` -- **Destruction verbs**: `remove`, `delete`, `unset`, `destroy`, `clean`, `clear`, `purge` - -[Verb group + Name] must be unique within the namespace of the workspace. +Keywords that describe the action an executable performs. While executables are configured with a single verb, +the verb can be aliased to related verbs within its group. For example, the `activate` verb can be replaced +with "enable" or "start" when referencing an executable. This allows users to use the verb that best describes +the action they are performing. + +### Verb Groups + +- **Activation Group**: `activate`, `enable`, `start`, `trigger` +- **Execution Group**: `exec`, `run`, `execute` +- **Deactivation Group**: `deactivate`, `disable`, `stop`, `pause` +- **Termination Group**: `kill`, `terminate`, `abort` +- **Monitoring Group**: `watch`, `monitor`, `track` +- **Restart Group**: `restart`, `reboot`, `reload`, `refresh` +- **Installation Group**: `install`, `setup`, `deploy` +- **Build Group**: `build`, `package`, `bundle`, `compile` +- **Uninstallation Group**: `uninstall`, `teardown`, `undeploy` +- **Update Group**: `update`, `upgrade`, `patch` +- **Configuration Group**: `configure`, `manage` +- **Edit Group**: `edit`, `transform`, `modify` +- **Publish Group**: `publish`, `release` +- **Distribution Group**: `push`, `send`, `apply` +- **Test Group**: `test`, `validate`, `check`, `verify` +- **Analysis Group**: `analyze`, `scan`, `lint`, `inspect` +- **Launch Group**: `open`, `launch`, `show`, `view` +- **Creation Group**: `create`, `generate`, `add`, `new`, `init` +- **Set Group**: `set` +- **Destruction Group**: `remove`, `delete`, `destroy`, `erase` +- **Unset Group**: `unset`, `reset` +- **Cleanup Group**: `clean`, `clear`, `purge`, `tidy` +- **Retrieval Group**: `retrieve`, `fetch`, `get`, `request` + +### Usage Notes + +1. [Verb group + Name] must be unique within the namespace of the workspace. +2. When referencing an executable, users can use any verb from the appropriate group. +3. Choose the verb that most accurately describes the action being performed. +4. Be consistent in verb usage within projects or teams to maintain clarity. + +### Examples + +- An executable configured with the `activate` verb could also be referenced using "enable" or "start". +- A build process might use `build` as its primary verb, but could also be invoked with "package" or "assemble". +- A cleanup routine configured with `clean` could be called using "purge" or "sanitize" for more specific connotations. + +By organizing verbs into these groups, flow provides flexibility in how actions are described while maintaining a +clear structure for executable operations. **Type:** `string` **Default:** `exec` **Valid values:** +- `activate` +- `enable` +- `start` +- `trigger` - `exec` - `run` -- `start` +- `execute` +- `deactivate` +- `disable` +- `stop` +- `pause` +- `kill` +- `terminate` +- `abort` +- `watch` +- `monitor` +- `track` +- `restart` +- `reboot` +- `reload` +- `refresh` - `install` - `setup` -- `release` - `deploy` -- `apply` -- `delete` +- `build` +- `package` +- `bundle` +- `compile` - `uninstall` -- `destroy` +- `teardown` - `undeploy` - `update` - `upgrade` -- `refresh` -- `reload` -- `manage` +- `patch` - `configure` -- `monitor` +- `manage` - `edit` +- `transform` +- `modify` +- `publish` +- `release` +- `push` +- `send` +- `apply` +- `test` +- `validate` +- `check` +- `verify` +- `analyze` +- `scan` +- `lint` +- `inspect` - `open` - `launch` - `show` - `view` -- `render` +- `create` - `generate` - `add` - `new` -- `build` -- `transform` +- `init` +- `set` +- `remove` +- `delete` +- `destroy` +- `erase` +- `unset` +- `reset` +- `clean` +- `clear` +- `purge` +- `tidy` +- `retrieve` +- `fetch` +- `get` +- `request` diff --git a/types/executable/executable.gen.go b/types/executable/executable.gen.go index e30f43a..7d47320 100644 --- a/types/executable/executable.gen.go +++ b/types/executable/executable.gen.go @@ -394,33 +394,79 @@ type SerialRefConfigList []SerialRefConfig type Verb string +const VerbAbort Verb = "abort" +const VerbActivate Verb = "activate" const VerbAdd Verb = "add" +const VerbAnalyze Verb = "analyze" const VerbApply Verb = "apply" const VerbBuild Verb = "build" +const VerbBundle Verb = "bundle" +const VerbCheck Verb = "check" +const VerbClean Verb = "clean" +const VerbClear Verb = "clear" +const VerbCompile Verb = "compile" const VerbConfigure Verb = "configure" +const VerbCreate Verb = "create" +const VerbDeactivate Verb = "deactivate" const VerbDelete Verb = "delete" const VerbDeploy Verb = "deploy" const VerbDestroy Verb = "destroy" +const VerbDisable Verb = "disable" const VerbEdit Verb = "edit" +const VerbEnable Verb = "enable" +const VerbErase Verb = "erase" const VerbExec Verb = "exec" +const VerbExecute Verb = "execute" +const VerbFetch Verb = "fetch" const VerbGenerate Verb = "generate" +const VerbGet Verb = "get" +const VerbInit Verb = "init" +const VerbInspect Verb = "inspect" const VerbInstall Verb = "install" +const VerbKill Verb = "kill" const VerbLaunch Verb = "launch" +const VerbLint Verb = "lint" const VerbManage Verb = "manage" +const VerbModify Verb = "modify" const VerbMonitor Verb = "monitor" const VerbNew Verb = "new" const VerbOpen Verb = "open" +const VerbPackage Verb = "package" +const VerbPatch Verb = "patch" +const VerbPause Verb = "pause" +const VerbPublish Verb = "publish" +const VerbPurge Verb = "purge" +const VerbPush Verb = "push" +const VerbReboot Verb = "reboot" const VerbRefresh Verb = "refresh" const VerbRelease Verb = "release" const VerbReload Verb = "reload" -const VerbRender Verb = "render" +const VerbRemove Verb = "remove" +const VerbRequest Verb = "request" +const VerbReset Verb = "reset" +const VerbRestart Verb = "restart" +const VerbRetrieve Verb = "retrieve" const VerbRun Verb = "run" +const VerbScan Verb = "scan" +const VerbSend Verb = "send" +const VerbSet Verb = "set" const VerbSetup Verb = "setup" const VerbShow Verb = "show" const VerbStart Verb = "start" +const VerbStop Verb = "stop" +const VerbTeardown Verb = "teardown" +const VerbTerminate Verb = "terminate" +const VerbTest Verb = "test" +const VerbTidy Verb = "tidy" +const VerbTrack Verb = "track" const VerbTransform Verb = "transform" +const VerbTrigger Verb = "trigger" const VerbUndeploy Verb = "undeploy" const VerbUninstall Verb = "uninstall" +const VerbUnset Verb = "unset" const VerbUpdate Verb = "update" const VerbUpgrade Verb = "upgrade" +const VerbValidate Verb = "validate" +const VerbVerify Verb = "verify" const VerbView Verb = "view" +const VerbWatch Verb = "watch" diff --git a/types/executable/executable_schema.yaml b/types/executable/executable_schema.yaml index 3568e16..9443bd7 100644 --- a/types/executable/executable_schema.yaml +++ b/types/executable/executable_schema.yaml @@ -10,28 +10,153 @@ definitions: Verb: type: string description: | - Keywords that describe the action an executable performs. - While executables are configured with a single verb, the verb can be aliased to related verbs. - For example, the `exec` verb can replaced with "run" or "start" when referencing an executable. - This allows users to use the verb that best describes the action they are performing. + Keywords that describe the action an executable performs. While executables are configured with a single verb, + the verb can be aliased to related verbs within its group. For example, the `activate` verb can be replaced + with "enable" or "start" when referencing an executable. This allows users to use the verb that best describes + the action they are performing. + + ### Verb Groups + + - **Activation Group**: `activate`, `enable`, `start`, `trigger` + - **Execution Group**: `exec`, `run`, `execute` + - **Deactivation Group**: `deactivate`, `disable`, `stop`, `pause` + - **Termination Group**: `kill`, `terminate`, `abort` + - **Monitoring Group**: `watch`, `monitor`, `track` + - **Restart Group**: `restart`, `reboot`, `reload`, `refresh` + - **Installation Group**: `install`, `setup`, `deploy` + - **Build Group**: `build`, `package`, `bundle`, `compile` + - **Uninstallation Group**: `uninstall`, `teardown`, `undeploy` + - **Update Group**: `update`, `upgrade`, `patch` + - **Configuration Group**: `configure`, `manage` + - **Edit Group**: `edit`, `transform`, `modify` + - **Publish Group**: `publish`, `release` + - **Distribution Group**: `push`, `send`, `apply` + - **Test Group**: `test`, `validate`, `check`, `verify` + - **Analysis Group**: `analyze`, `scan`, `lint`, `inspect` + - **Launch Group**: `open`, `launch`, `show`, `view` + - **Creation Group**: `create`, `generate`, `add`, `new`, `init` + - **Set Group**: `set` + - **Destruction Group**: `remove`, `delete`, `destroy`, `erase` + - **Unset Group**: `unset`, `reset` + - **Cleanup Group**: `clean`, `clear`, `purge`, `tidy` + - **Retrieval Group**: `retrieve`, `fetch`, `get`, `request` + + ### Usage Notes + + 1. [Verb group + Name] must be unique within the namespace of the workspace. + 2. When referencing an executable, users can use any verb from the appropriate group. + 3. Choose the verb that most accurately describes the action being performed. + 4. Be consistent in verb usage within projects or teams to maintain clarity. - - **Activation verbs**: `exec`, `run`, `start`, `activate`, `enable`, `watch` - - **Deactivation verbs**: `deactivate`, `disable`, `stop`, `kill` - - **Restart verbs**: `restart`, `reboot`, `reload`, `refresh` - - **Install verbs**: `install`, `setup`, `build`, `package`, `bundle` - - **Uninstall verbs**: `uninstall`, `teardown`, `undeploy` - - **Update verbs**: `update`, `upgrade`, `patch`, `edit`, `transform`, `manage`, `configure` - - **Publish verbs**: `publish`, `release`, `deploy`, `apply`, `push`, `send` - - **Management verbs**: `manage`, `configure`, `monitor`, `edit` - - **Test verbs**: `test`, `validate`, `check`, `verify` - - **Analyze verbs**: `analyze`, `scan`, `lint`, `audit` - - **Launch verbs**: `open`, `launch`, `show`, `view`, `render` - - **Creation verbs**: `generate`, `add`, `new`, `create`, `init`, `set` - - **Destruction verbs**: `remove`, `delete`, `unset`, `destroy`, `clean`, `clear`, `purge` + ### Examples - [Verb group + Name] must be unique within the namespace of the workspace. + - An executable configured with the `activate` verb could also be referenced using "enable" or "start". + - A build process might use `build` as its primary verb, but could also be invoked with "package" or "assemble". + - A cleanup routine configured with `clean` could be called using "purge" or "sanitize" for more specific connotations. + + By organizing verbs into these groups, flow provides flexibility in how actions are described while maintaining a + clear structure for executable operations. default: exec - enum: [ exec, run, start, install, setup, release, deploy, apply, delete, uninstall, destroy, undeploy, update, upgrade, refresh, reload, manage, configure, monitor, edit, open, launch, show, view, render, generate, add, new, build, transform ] + enum: + # Activation Group + - activate + - enable + - start + - trigger + # Execution Group + - exec + - run + - execute + # Deactivation Group + - deactivate + - disable + - stop + - pause + # Termination Group + - kill + - terminate + - abort + # Monitoring Group + - watch + - monitor + - track + # Restart Group + - restart + - reboot + - reload + - refresh + # Installation Group + - install + - setup + - deploy + # Build Group + - build + - package + - bundle + - compile + # Uninstallation Group + - uninstall + - teardown + - undeploy + # Update Group + - update + - upgrade + - patch + # Configuration Group + - configure + - manage + # Edit Group + - edit + - transform + - modify + # Publish Group + - publish + - release + # Distribution Group + - push + - send + - apply + # Test Group + - test + - validate + - check + - verify + # Analysis Group + - analyze + - scan + - lint + - inspect + # Launch Group + - open + - launch + - show + - view + # Creation Group + - create + - generate + - add + - new + - init + # Set Group + - set + # Destruction Group + - remove + - delete + - destroy + - erase + # Unset Group + - unset + - reset + # Cleanup Group + - clean + - clear + - purge + - tidy + # Retrieval Group + - retrieve + - fetch + - get + - request Ref: type: string description: | diff --git a/types/executable/ref.go b/types/executable/ref.go index b5bcd71..ed4b5f6 100644 --- a/types/executable/ref.go +++ b/types/executable/ref.go @@ -9,116 +9,150 @@ import ( ) const ( - ActivateGroupID = "activate" - DeactivateGroupID = "deactivate" - RestartGroupID = "restart" - InstallGroup = "install" - UninstallGroup = "uninstall" - PublishGroupID = "publish" - CreationGroupID = "create" - DeleteGroupID = "delete" - UpdateGroupID = "update" - TestGroupID = "test" - AnalyzeGroupID = "analyze" - LaunchGroupID = "launch" + ActivateGroupID = "activate" + DeactivateGroupID = "deactivate" + ExecutionGroupID = "execute" + TerminationGroupID = "terminate" + MonitoringGroupID = "monitor" + RestartGroupID = "restart" + InstallGroupID = "install" + BuildGroupID = "build" + UninstallGroupID = "uninstall" + PublishGroupID = "publish" + DistributionGroupID = "distribute" + TestGroupID = "test" + AnalyzeGroupID = "analyze" + LaunchGroupID = "launch" + CreationGroupID = "create" + SetGroupID = "set" + DestructionGroupID = "destroy" + UnsetGroupID = "unset" + CleanupGroupID = "cleanup" + RetrievalGroupID = "retrieve" ) var ( - ValidVerbToGroupID = map[string]string{ + ValidVerbToGroupID = map[Verb]string{ // Activation verbs - "exec": ActivateGroupID, - "run": ActivateGroupID, - "start": ActivateGroupID, - "activate": ActivateGroupID, - "enable": ActivateGroupID, - "watch": ActivateGroupID, + VerbActivate: ActivateGroupID, + VerbEnable: ActivateGroupID, + VerbStart: ActivateGroupID, + VerbTrigger: ActivateGroupID, + + // Execution verbs + VerbExec: ExecutionGroupID, + VerbRun: ExecutionGroupID, + VerbExecute: ExecutionGroupID, // Deactivation verbs - "deactivate": DeactivateGroupID, - "disable": DeactivateGroupID, - "stop": DeactivateGroupID, - "kill": DeactivateGroupID, + VerbDeactivate: DeactivateGroupID, + VerbDisable: DeactivateGroupID, + VerbStop: DeactivateGroupID, + VerbPause: DeactivateGroupID, + + // Termination verbs + VerbKill: TerminationGroupID, + VerbTerminate: TerminationGroupID, + VerbAbort: TerminationGroupID, + + // Monitoring verbs + VerbWatch: MonitoringGroupID, + VerbMonitor: MonitoringGroupID, + VerbTrack: MonitoringGroupID, // Restart verbs - "restart": RestartGroupID, - "reboot": RestartGroupID, - "reload": RestartGroupID, - "refresh": RestartGroupID, - - // Install verbs - "install": InstallGroup, - "setup": InstallGroup, - "build": InstallGroup, - "package": InstallGroup, - "bundle": InstallGroup, - - // Uninstall verbs - "uninstall": UninstallGroup, - "teardown": UninstallGroup, - "undeploy": UninstallGroup, + VerbRestart: RestartGroupID, + VerbReboot: RestartGroupID, + VerbReload: RestartGroupID, + VerbRefresh: RestartGroupID, + + // Installation verbs + VerbInstall: InstallGroupID, + VerbSetup: InstallGroupID, + VerbDeploy: InstallGroupID, + + // Build verbs + VerbBuild: BuildGroupID, + VerbPackage: BuildGroupID, + VerbBundle: BuildGroupID, + VerbCompile: BuildGroupID, + + // Uninstallation verbs + VerbUninstall: UninstallGroupID, + VerbTeardown: UninstallGroupID, + VerbUndeploy: UninstallGroupID, // Publish verbs - "publish": PublishGroupID, - "release": PublishGroupID, - "deploy": PublishGroupID, - "apply": PublishGroupID, - "push": PublishGroupID, - "send": PublishGroupID, - - // Update verbs - "update": UpdateGroupID, - "upgrade": UpdateGroupID, - "patch": UpdateGroupID, - "edit": UpdateGroupID, - "transform": UpdateGroupID, - "manage": UpdateGroupID, - "configure": UpdateGroupID, + VerbPublish: PublishGroupID, + VerbRelease: PublishGroupID, + + // Distribution verbs + VerbPush: DistributionGroupID, + VerbSend: DistributionGroupID, + VerbApply: DistributionGroupID, // Test verbs - "test": TestGroupID, - "validate": TestGroupID, - "check": TestGroupID, - "verify": TestGroupID, + VerbTest: TestGroupID, + VerbValidate: TestGroupID, + VerbCheck: TestGroupID, + VerbVerify: TestGroupID, - // Analyze verbs - "analyze": AnalyzeGroupID, - "lint": AnalyzeGroupID, - "audit": AnalyzeGroupID, - "scan": AnalyzeGroupID, + // Analysis verbs + VerbAnalyze: AnalyzeGroupID, + VerbScan: AnalyzeGroupID, + VerbLint: AnalyzeGroupID, + VerbInspect: AnalyzeGroupID, // Launch verbs - "open": LaunchGroupID, - "launch": LaunchGroupID, - "show": LaunchGroupID, - "view": LaunchGroupID, - "render": LaunchGroupID, + VerbOpen: LaunchGroupID, + VerbLaunch: LaunchGroupID, + VerbShow: LaunchGroupID, + VerbView: LaunchGroupID, // Creation verbs - "generate": CreationGroupID, - "add": CreationGroupID, - "new": CreationGroupID, - "create": CreationGroupID, - "init": CreationGroupID, - "set": CreationGroupID, - - // Deletion verbs - "remove": DeleteGroupID, - "delete": DeleteGroupID, - "unset": DeleteGroupID, - "destroy": DeleteGroupID, - "clear": DeleteGroupID, - "purge": DeleteGroupID, - "clean": DeleteGroupID, + VerbCreate: CreationGroupID, + VerbGenerate: CreationGroupID, + VerbAdd: CreationGroupID, + VerbNew: CreationGroupID, + VerbInit: CreationGroupID, + + // Set verbs + VerbSet: SetGroupID, + + // Destruction verbs + VerbRemove: DestructionGroupID, + VerbDelete: DestructionGroupID, + VerbDestroy: DestructionGroupID, + VerbErase: DestructionGroupID, + + // Unset verbs + VerbUnset: UnsetGroupID, + VerbReset: UnsetGroupID, + + // Cleanup verbs + VerbClean: CleanupGroupID, + VerbClear: CleanupGroupID, + VerbPurge: CleanupGroupID, + VerbTidy: CleanupGroupID, + + // Retrieval verbs + VerbRetrieve: RetrievalGroupID, + VerbFetch: RetrievalGroupID, + VerbGet: RetrievalGroupID, + VerbRequest: RetrievalGroupID, } ) -func ValidVerbs() []string { +func ValidVerbs() []Verb { return maps.Keys(ValidVerbToGroupID) } func SortedValidVerbs() []string { - verbs := ValidVerbs() - slices.SortFunc(verbs, strings.Compare) + verbs := make([]string, 0) + for _, v := range ValidVerbs() { + verbs = append(verbs, v.String()) + } + slices.Sort(verbs) return verbs } @@ -127,21 +161,21 @@ func (v Verb) String() string { } func (v Verb) Validate() error { - if !slices.Contains(ValidVerbs(), v.String()) { + if !slices.Contains(ValidVerbs(), v) { return fmt.Errorf("invalid executable verb %s", v) } return nil } func (v Verb) Equals(other Verb) bool { - return ValidVerbToGroupID[v.String()] == ValidVerbToGroupID[other.String()] + return ValidVerbToGroupID[v] == ValidVerbToGroupID[other] } func RelatedVerbs(verb Verb) []Verb { verbs := make([]Verb, 0) for _, v := range ValidVerbs() { - if ValidVerbToGroupID[v] == ValidVerbToGroupID[verb.String()] { - verbs = append(verbs, Verb(v)) + if ValidVerbToGroupID[v] == ValidVerbToGroupID[verb] { + verbs = append(verbs, v) } } return slices.Compact(verbs)