mirror of
https://github.com/thegeeklab/url-parser.git
synced 2024-11-15 17:50:40 +00:00
c6b5c9d03d
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Robert Kaussow <mail@thegeeklab.de>
25 lines
404 B
Go
25 lines
404 B
Go
package command
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/thegeeklab/url-parser/config"
|
|
"github.com/urfave/cli/v2"
|
|
)
|
|
|
|
// Password prints out the password part from url.
|
|
func Password(cfg *config.Config) cli.ActionFunc {
|
|
return func(_ *cli.Context) error {
|
|
parts := parseURL(cfg.URL)
|
|
|
|
if parts.User != nil {
|
|
pw, _ := parts.User.Password()
|
|
if len(pw) > 0 {
|
|
fmt.Println(pw)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
}
|