Skip to content

Commit ae522e2

Browse files
committed
#215 feat: enhance Install-NovaCli output with installed path and next steps guidance
2 parents e0ca8bc + 71855b5 commit ae522e2

5 files changed

Lines changed: 64 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
2121
- `Get-NovaProjectInfo` now fails with clearer recovery guidance when `-Path` does not exist, points to a file, or the target folder is missing `project.json`.
2222
- `Get-NovaUpdateNotificationPreference -Verbose` now explains whether Nova is reading a stored preference or the built-in default, and the command help now points read-only PowerShell users to the matching `% nova notification` workflow.
2323
- `Initialize-NovaModule` now shows scaffold progress, ends with the created project root plus the next suggested cmdlet, and fails with clearer guidance when the target project folder already exists.
24+
- `Install-NovaCli` now prints the installed launcher path, suggests the next command to run, and gives a clearer `PATH` warning when the destination directory is not yet available from the shell.
2425

2526
### Deprecated
2627

RELEASE_NOTE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ This file summarizes the release notes for NovaModuleTools. **UNRELEASED** chang
1717
- `Get-NovaProjectInfo` now explains how to recover when `-Path` is invalid or the target folder is not a Nova project root.
1818
- `Get-NovaUpdateNotificationPreference -Verbose` now tells you whether Nova is using a stored update-notification preference or the built-in default, and the help now points to the matching `% nova notification` workflow.
1919
- `Initialize-NovaModule` now shows scaffold progress, ends with the project root and the next suggested cmdlet, and gives clearer recovery guidance when the target project folder already exists.
20+
- `Install-NovaCli` now prints the installed launcher path, suggests the next command to run, and gives a clearer `PATH` warning when the launcher directory is not yet available from the shell.
2021

2122
### Deprecated
2223

docs/NovaModuleTools/en-US/Install-NovaCli.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ PS> Install-NovaCli [[-DestinationDirectory] <string>] [-Force] [-WhatIf] [-Conf
3030
By default, the launcher is installed to `~/.local/bin/nova` on macOS and Linux. If that directory is not on your
3131
`PATH`, the command warns so you can update your shell profile.
3232

33-
After a successful install, `Install-NovaCli` also prints the release notes link from the installed module manifest.
33+
After a successful install, `Install-NovaCli` prints the installed launcher path, suggests the next command to run,
34+
and also prints the release notes link from the installed module manifest.
3435

3536
Use this command when you want `nova` to be available directly from your shell as the launcher-oriented CLI entrypoint.
3637

@@ -168,8 +169,13 @@ Returns the installed command name, destination directory, installed path, and w
168169

169170
## NOTES
170171

171-
After running `Install-NovaCli`, add the destination directory to your shell `PATH` if needed.
172+
`Install-NovaCli` currently supports macOS and Linux. On Windows, use `Invoke-NovaCli` from `pwsh` after importing
173+
NovaModuleTools.
174+
175+
After running `Install-NovaCli`, add the destination directory to your shell `PATH` if needed, start a new shell,
176+
and then run `nova --help` to confirm the launcher is available.
172177

173178
## RELATED LINKS
174179

180+
- [Update-NovaModuleTool](./Update-NovaModuleTools.md)
175181
- [Publish-NovaModule](./Publish-NovaModule.md)

src/private/cli/InvokeNovaCliInstallWorkflow.ps1

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,52 @@ function Invoke-NovaCliInstallWorkflow {
77
$installedPath = Copy-NovaCliLauncher -SourcePath $WorkflowContext.SourcePath -TargetPath $WorkflowContext.TargetPath -Force:$WorkflowContext.Force
88
$directoryOnPath = Test-NovaCliDirectoryOnPath -Directory $WorkflowContext.TargetDirectory
99
if (-not $directoryOnPath) {
10-
Write-Warning "Installed nova to $( $WorkflowContext.TargetDirectory ), but that directory is not currently in PATH. Add it to your shell profile before using nova directly from zsh/bash."
10+
Write-Warning "Installed nova to $( $WorkflowContext.TargetDirectory ), but that directory is not currently in PATH. Add it to your shell profile, start a new shell, and then run 'nova --help'."
1111
}
1212

1313
$releaseNotesUri = Get-NovaModuleReleaseNotesUri
14-
15-
return [pscustomobject]@{
14+
$result = [pscustomobject]@{
1615
CommandName = 'nova'
1716
InstalledPath = $installedPath
1817
DestinationDirectory = $WorkflowContext.TargetDirectory
1918
DirectoryOnPath = $directoryOnPath
2019
ReleaseNotesUri = $releaseNotesUri
2120
}
21+
22+
Write-NovaCliInstallResult -Result $result
23+
return $result
24+
}
25+
26+
function Write-NovaCliInstallResult {
27+
[CmdletBinding()]
28+
param(
29+
[Parameter(Mandatory)][pscustomobject]$Result
30+
)
31+
32+
Write-Host "Installed nova launcher: $( $Result.InstalledPath )"
33+
34+
foreach ($line in (Get-NovaCliInstallNextStepLine -Result $Result)) {
35+
Write-Host $line
36+
}
37+
}
38+
39+
function Get-NovaCliInstallNextStepLine {
40+
[CmdletBinding()]
41+
param(
42+
[Parameter(Mandatory)][pscustomobject]$Result
43+
)
44+
45+
if ($Result.DirectoryOnPath) {
46+
return @(
47+
'Next step:'
48+
'nova --help'
49+
)
50+
}
51+
52+
return @(
53+
'Next steps:'
54+
"Add $( $Result.DestinationDirectory ) to your PATH"
55+
'Start a new shell'
56+
'nova --help'
57+
)
2258
}

tests/private/cli/InvokeNovaCliInstallWorkflow.Tests.ps1

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ BeforeAll {
99

1010
Describe 'Invoke-NovaCliInstallWorkflow' {
1111
It 'returns workflow result when directory is on PATH' {
12+
Mock Write-Host {}
13+
1214
$ctx = [pscustomobject]@{
1315
SourcePath = '/tmp/src/nova'
1416
TargetPath = '/usr/local/bin/nova'
@@ -20,12 +22,25 @@ Describe 'Invoke-NovaCliInstallWorkflow' {
2022
$result.InstalledPath | Should -Be '/usr/local/bin/nova'
2123
$result.DirectoryOnPath | Should -BeTrue
2224
$result.ReleaseNotesUri | Should -Be 'https://example.test/notes'
25+
Assert-MockCalled Write-Host -Times 3
26+
Assert-MockCalled Write-Host -Times 1 -ParameterFilter {
27+
$Object -eq 'Installed nova launcher: /usr/local/bin/nova' -or $args -contains 'Installed nova launcher: /usr/local/bin/nova'
28+
}
29+
Assert-MockCalled Write-Host -Times 1 -ParameterFilter {
30+
$Object -eq 'nova --help' -or $args -contains 'nova --help'
31+
}
2332
}
2433

2534
It 'warns when target directory is not on PATH' {
35+
Mock Write-Host {}
2636
Mock Test-NovaCliDirectoryOnPath {return $false}
2737
$ctx = [pscustomobject]@{SourcePath = '/s'; TargetPath = '/t/nova'; TargetDirectory = '/t'; Force = $false}
2838
Invoke-NovaCliInstallWorkflow -WorkflowContext $ctx -WarningVariable warning -WarningAction SilentlyContinue | Out-Null
2939
$warning.Count | Should -BeGreaterThan 0
40+
$warning[0].Message | Should -Be "Installed nova to /t, but that directory is not currently in PATH. Add it to your shell profile, start a new shell, and then run 'nova --help'."
41+
Assert-MockCalled Write-Host -Times 4
42+
Assert-MockCalled Write-Host -Times 1 -ParameterFilter {
43+
$Object -eq 'Add /t to your PATH' -or $args -contains 'Add /t to your PATH'
44+
}
3045
}
3146
}

0 commit comments

Comments
 (0)