Skip to content

Commit

Permalink
Add Windows implementations for the secret testscripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
zb140 committed May 9, 2020
1 parent bf8c779 commit f644717
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 9 deletions.
11 changes: 8 additions & 3 deletions testdata/scripts/secretgeneric.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
[windows] stop # FIXME

chmod 755 bin/secret
chmod 700 $HOME/.local/share/chezmoi

Expand All @@ -13,6 +11,13 @@ cmp $HOME/.netrc golden/.netrc
#!/bin/sh

echo "$*"
-- bin/secret.cmd --
@echo off
setlocal
set out=%*
set out=%out:\=%
echo %out%
endlocal
-- golden/.netrc --
machine example.com
login examplelogin
Expand All @@ -23,7 +28,7 @@ login examplelogin2
password examplepassword2
-- home/user/.config/chezmoi/chezmoi.toml --
[genericSecret]
command = "echo"
command = "secret"
-- home/user/.local/share/chezmoi/private_dot_netrc.tmpl --
machine example.com
login examplelogin
Expand Down
11 changes: 9 additions & 2 deletions testdata/scripts/secretgopass.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
[windows] stop # FIXME

chmod 755 bin/gopass
chmod 700 $HOME/.local/share/chezmoi

Expand All @@ -20,6 +18,15 @@ case "$*" in
echo "gopass: invalid command: $*"
exit 1
esac
-- bin/gopass.cmd --
@echo off
IF "%*" == "show misc/example.com" (
echo | set /p=examplepassword
exit /b 0
) ELSE (
echo gopass: invalid command: %*
exit /b 1
)
-- home/user/.local/share/chezmoi/private_dot_netrc.tmpl --
machine example.com
login examplelogin
Expand Down
22 changes: 20 additions & 2 deletions testdata/scripts/secretlastpass.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
[windows] stop # FIXME

chmod 755 bin/lpass
chmod 700 $HOME/.local/share/chezmoi

Expand Down Expand Up @@ -38,6 +36,26 @@ EOF
echo "lpass: invalid command: $*"
exit 1
esac
-- bin/lpass.cmd --
@echo off
IF "%*" == "--version" (
echo LastPass CLI v1.3.3.GIT
) ELSE IF "%*" == "show --json example.com" (
echo.[
echo. {
echo. "id": "0",
echo. "name": "example.com",
echo. "fullname": "Examples/example.com",
echo. "username": "examplelogin",
echo. "password": "examplepassword",
echo. "last_modified_gmt": "0",
echo. "last_touch": "0",
echo. "group": "Examples",
echo. "url": "",
echo. "note": ""
echo. }
echo.]
)
-- home/user/.local/share/chezmoi/private_dot_netrc.tmpl --
machine example.com
login {{ (index (lastpass "example.com") 0).username }}
Expand Down
11 changes: 9 additions & 2 deletions testdata/scripts/secretpass.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
[windows] stop # FIXME

chmod 755 bin/pass
chmod 700 $HOME/.local/share/chezmoi

Expand All @@ -20,6 +18,15 @@ case "$*" in
echo "pass: invalid command: $*"
exit 1
esac
-- bin/pass.cmd --
@echo off
IF "%*" == "show misc/example.com" (
echo | set /p=examplepassword
exit /b 0
) ELSE (
echo pass: invalid command: %*
exit /b 1
)
-- home/user/.local/share/chezmoi/private_dot_netrc.tmpl --
machine example.com
login examplelogin
Expand Down

0 comments on commit f644717

Please sign in to comment.