diff options
author | Teddy Wing | 2017-06-03 21:36:20 +0200 |
---|---|---|
committer | Teddy Wing | 2017-06-03 21:37:43 +0200 |
commit | f5b1fb3d0ef37ed44b8f7302343dcd5cd16bd725 (patch) | |
tree | 58b43be49d3e470d68543ced658c22c9ea07bf9b /main.go | |
parent | 403c92bf583cec66677d93ea470ec58312c8240b (diff) | |
download | timetasker-f5b1fb3d0ef37ed44b8f7302343dcd5cd16bd725.tar.bz2 |
Make the `password_cmd` config setting work
Given a string from `password_cmd`, we should execute it as a shell
command and assume the result is a password. That password then gets
submitted to TimeTask's login form for authentication.
Had to do a bit of wrangling to get the command to execute by
`exec.Command()`, but managed to get it working in a bit of a roundabout
way.
Found these resources in my searches:
- https://stackoverflow.com/questions/39930109/golang-execute-command#39930127
https://stackoverflow.com/questions/28783637/how-to-make-golang-execute-a-string
- https://stackoverflow.com/questions/20437336/how-to-execute-system-command-in-golang-with-unknown-arguments
- https://github.com/codeskyblue/go-sh
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -87,9 +87,12 @@ func main() { *description, ) + password, err := passwordCmd(config.Auth.PasswordCmd) + kingpin.FatalIfError(err, "password command failed") + resp, client, err := timetask.Login( config.Auth.Username, - config.Auth.PasswordCmd, + password, ) kingpin.FatalIfError(err, "Login request failed") log.Printf("%+v\n", resp) |