-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support tracking for all commands
- Loading branch information
Showing
12 changed files
with
86 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { CommandContext, CommandHandlerFunction } from "../types/command" | ||
import { ProcessOutput } from "@angular-devkit/core/node" | ||
|
||
export function trackCommandHandler< | ||
TData, | ||
TError, | ||
TCommandArguments extends Record<string, any> | ||
>( | ||
ctx: CommandContext, | ||
handler: ( | ||
ctx: CommandContext, | ||
stdout?: ProcessOutput, | ||
stderr?: ProcessOutput | ||
) => CommandHandlerFunction<TData, TError, TCommandArguments> | ||
): CommandHandlerFunction<TData, TError, TCommandArguments> { | ||
return (args) => { | ||
console.log(args) | ||
if (ctx.posthog) { | ||
// Making sure to filter out any properties that might contain sensitive information | ||
const { _, $0, password, username, ...rest } = args | ||
ctx.posthog.postHogCapture({ | ||
event: `composable cli command ${args._.join(" ")}`, | ||
properties: { | ||
...rest, | ||
}, | ||
}) | ||
} | ||
|
||
return handler(ctx)(args) | ||
} | ||
} |