File tree 5 files changed +71
-1
lines changed
5 files changed +71
-1
lines changed Original file line number Diff line number Diff line change 11
11
"MD036" : false ,
12
12
},
13
13
"cSpell.words" : [
14
- " datadir"
14
+ " datadir" ,
15
+ " sysinfo"
15
16
]
16
17
}
Original file line number Diff line number Diff line change
1
+ #
2
+ # Module for 1Password integration
3
+ #
4
+ # See: https://developer.1password.com/docs/ssh/get-started
5
+ #
6
+
1
7
# Stop on every error
2
8
$script :ErrorActionPreference = ' Stop'
3
9
@@ -6,6 +12,7 @@ Import-Module "$PSScriptRoot/Utils.psm1"
6
12
function Test-Is1PasswordIntegrationSupported () {
7
13
return Test-IsWindows -or $IsMacOs
8
14
}
15
+ Export-ModuleMember - Function Test-Is1PasswordIntegrationSupported
9
16
10
17
function Test-Is1PasswordInstalled () {
11
18
if (-Not (Test-Is1PasswordIntegrationSupported )) {
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ Import-Module "$PSScriptRoot/SshEnvAppAux.psm1"
12
12
Import-Module " $PSScriptRoot /Installation.psm1"
13
13
Import-Module " $PSScriptRoot /SshDataDir.psm1"
14
14
Import-Module " $PSScriptRoot /SshConfig.psm1"
15
+ Import-Module " $PSScriptRoot /SysInfo.psm1"
15
16
16
17
if ($args.Length -eq 0 ) {
17
18
Write-Help ' No command specified'
@@ -211,6 +212,11 @@ function Invoke-SshEnvApp {
211
212
break
212
213
}
213
214
215
+ ' sysinfo' {
216
+ Write-SysInfo
217
+ break
218
+ }
219
+
214
220
' version|--version|-v' {
215
221
$version = Get-EnvVersion
216
222
Write-Host " ssh-env version $version "
Original file line number Diff line number Diff line change
1
+ # Stop on every error
2
+ $script :ErrorActionPreference = ' Stop'
3
+
4
+ Import-Module " $PSScriptRoot /Utils.psm1"
5
+ Import-Module " $PSScriptRoot /Installation.psm1"
6
+ Import-Module " $PSScriptRoot /1Password.psm1"
7
+
8
+ function Get-OperatingSystemName () {
9
+ if (Test-IsWindows ) {
10
+ return ' Windows'
11
+ }
12
+ elseif ($IsMacOs ) {
13
+ return ' macOS'
14
+ }
15
+ elseif ($IsLinux ) {
16
+ return ' Linux'
17
+ }
18
+ else {
19
+ return ' unsupported'
20
+ }
21
+ }
22
+
23
+ function Get-1PasswordIntegrationStatus () {
24
+ if (-Not (Test-Is1PasswordIntegrationSupported )) {
25
+ return " unsupported operating system"
26
+ }
27
+
28
+ if (-Not (Test-Is1PasswordInstalled )) {
29
+ return " 1Password not installed"
30
+ }
31
+
32
+ if (-Not (Test-Is1PasswordSshAgentEnabled )) {
33
+ return " 1Password SSH agent not enabled"
34
+ }
35
+
36
+ return " 1Password SSH agent enabled"
37
+ }
38
+
39
+ function Write-SysInfo () {
40
+ $osName = Get-OperatingSystemName
41
+ Write-Host " Operating System: $osName "
42
+
43
+ if (Test-IsWindows ) {
44
+ if (Test-IsMicrosoftSsh ) {
45
+ Write-Host ' Use Microsoft SSH: yes'
46
+ }
47
+ else {
48
+ Write-Host ' Use Microsoft SSH: no'
49
+ }
50
+ }
51
+
52
+ $1passwordStatus = Get-1PasswordIntegrationStatus
53
+ Write-Host " 1Password Intergration: $1passwordStatus "
54
+ }
55
+ Export-ModuleMember - Function Write-SysInfo
Original file line number Diff line number Diff line change @@ -29,5 +29,6 @@ Commands:
29
29
key load Loads your private key into the ssh-agent (so that it can be used
30
30
by applications other than ssh-env)
31
31
32
+ sysinfo Displays various information about the system
32
33
help, --help, -h Displays this help page
33
34
version, --version, -v Prints the ssh-env and OpenSSH client version
You can’t perform that action at this time.
0 commit comments