github.com/rclone/rclone@v1.66.1-0.20240517100346-7b89735ae726/cmd/reveal/reveal.go (about)

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