authenticator.go 729 B

1234567891011121314151617181920212223242526272829
  1. package cmd
  2. import (
  3. "github.com/ente-io/cli/pkg/authenticator"
  4. "github.com/spf13/cobra"
  5. )
  6. // Define the 'config' command and its subcommands
  7. var authenticatorCmd = &cobra.Command{
  8. Use: "auth",
  9. Short: "Authenticator commands",
  10. }
  11. // Subcommand for 'config update'
  12. var decryptExportCmd = &cobra.Command{
  13. Use: "decrypt [input] [output]",
  14. Short: "Decrypt authenticator export",
  15. Args: cobra.ExactArgs(2), // Ensures exactly two arguments are passed
  16. RunE: func(cmd *cobra.Command, args []string) error {
  17. inputPath := args[0]
  18. outputPath := args[1]
  19. return authenticator.DecryptExport(inputPath, outputPath)
  20. },
  21. }
  22. func init() {
  23. rootCmd.AddCommand(authenticatorCmd)
  24. authenticatorCmd.AddCommand(decryptExportCmd)
  25. }