mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-23 07:17:36 +00:00
feat(cli): add standalone downloads and installers (#528)
* feat(cli): add standalone downloads and installers * fix(cli): silence PowerShell download progress * fix(cli): use framework APIs for Windows verification * fix(cli): preserve null backup path during Windows updates * docs(cli): translate native installation quickstart into Chinese
This commit is contained in:
@@ -25,6 +25,7 @@ import {
|
||||
import type { CallOperation } from './operations/call-operation'
|
||||
import { CliError, formatCliError } from './operations/errors'
|
||||
import { createProgram } from './program'
|
||||
import { version } from '../package.json'
|
||||
|
||||
/** Runs the CLI with mocked Operation calls and captures stdout/stderr. */
|
||||
function setup() {
|
||||
@@ -75,6 +76,13 @@ const pendingRead = {
|
||||
}
|
||||
|
||||
describe('shumai-cli', () => {
|
||||
it('reports its package version without calling the server', async () => {
|
||||
const cli = setup()
|
||||
await expect(cli.run('--version')).rejects.toMatchObject({ code: 'commander.version' })
|
||||
expect(cli.stdout()).toBe(`${version}\n`)
|
||||
expect(cli.callOperation).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
const originalAllowDelete = process.env.SHUMAI_ALLOW_DELETE
|
||||
|
||||
afterEach(() => {
|
||||
|
||||
@@ -6,6 +6,7 @@ import { callOperation, type CallOperation } from './operations/call-operation'
|
||||
import { cliExtensions } from './operations/extensions'
|
||||
import { registerOperationCommands } from './operations/generate'
|
||||
import type { Output } from './operations/render'
|
||||
import { version } from '../package.json'
|
||||
|
||||
export interface ProgramOptions {
|
||||
callOperation?: CallOperation
|
||||
@@ -26,6 +27,7 @@ export function createProgram(options: ProgramOptions = {}): Command {
|
||||
const program = new Command()
|
||||
.name('shumai-cli')
|
||||
.description('Command line interface for the Shumai media workspace.')
|
||||
.version(version)
|
||||
.option('--json', 'Print raw JSON output instead of human-friendly text')
|
||||
.showHelpAfterError()
|
||||
.showSuggestionAfterError()
|
||||
|
||||
Reference in New Issue
Block a user