filebrowser/cmd/hash.go
Henrique Dias 25792232e6 feat: add hash command
License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>

Former-commit-id: 4d1b43927775194e96b8a9a3ae13fbffc21df572 [formerly b738daa5a48369b1fd5140a70b8b8965a34109e4] [formerly 5d2eefed13d38efdb480aab2d61a2e06244919eb [formerly a2742dff16]]
Former-commit-id: c4c6b087a91ea3d781fd5e5bbf9c511a9c25a312 [formerly 0aedca54ba1e98ad63e863fdd86e50123ad9078f]
Former-commit-id: b4581ad7c366baf486fc1412eaac4c6f9940b979
2019-01-06 17:53:47 +00:00

25 lines
445 B
Go

package cmd
import (
"fmt"
"github.com/filebrowser/filebrowser/v2/users"
"github.com/spf13/cobra"
)
func init() {
rootCmd.AddCommand(hashCmd)
}
var hashCmd = &cobra.Command{
Use: "hash <password>",
Short: "Hashes a password",
Long: `Hashes a password using bcrypt algorithm.`,
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
pwd, err := users.HashPwd(args[0])
checkErr(err)
fmt.Println(pwd)
},
}