reveal.go 718 B

1234567891011121314151617181920212223242526272829303132333435
  1. // Package reveal provides the reveal command.
  2. package reveal
  3. import (
  4. "fmt"
  5. "github.com/rclone/rclone/cmd"
  6. "github.com/rclone/rclone/fs/config/obscure"
  7. "github.com/spf13/cobra"
  8. )
  9. func init() {
  10. cmd.Root.AddCommand(commandDefinition)
  11. }
  12. var commandDefinition = &cobra.Command{
  13. Use: "reveal password",
  14. Short: `Reveal obscured password from rclone.conf`,
  15. Annotations: map[string]string{
  16. "versionIntroduced": "v1.43",
  17. },
  18. Run: func(command *cobra.Command, args []string) {
  19. cmd.CheckArgs(1, 1, command, args)
  20. cmd.Run(false, false, command, func() error {
  21. revealed, err := obscure.Reveal(args[0])
  22. if err != nil {
  23. return err
  24. }
  25. fmt.Println(revealed)
  26. return nil
  27. })
  28. },
  29. Hidden: true,
  30. }