A bare `talk version` was spoken as an announcement because only the --version flag existed. The subcommand prints the same line. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
2d9d2a86e9
commit
07c89f4939
3 files changed
+22
No files matched your search
@@ -28,6 +28,7 @@ dependencies.
|
|||||||
| `talk test` | speak a test sentence; shows provider and timings (`--lang`, `--provider`, `--voice`); `--toast` sends a test notification instead |
|
| `talk test` | speak a test sentence; shows provider and timings (`--lang`, `--provider`, `--voice`); `--toast` sends a test notification instead |
|
||||||
| `talk doctor` | self-diagnosis: config, daemon, audio, providers, notifications, mute, laws (`--probe`, `--json`) |
|
| `talk doctor` | self-diagnosis: config, daemon, audio, providers, notifications, mute, laws (`--probe`, `--json`) |
|
||||||
| `talk setup` | first-time setup in a few questions: language, voices with preview, quiet hours, config.toml |
|
| `talk setup` | first-time setup in a few questions: language, voices with preview, quiet hours, config.toml |
|
||||||
|
| `talk version` | version and commit (also `talk --version`) |
|
||||||
|
|
||||||
Say flags (also for `talk "text"`): `--wait`, `--now`, `--priority`,
|
Say flags (also for `talk "text"`): `--wait`, `--now`, `--priority`,
|
||||||
`--voice`, `--lang`, `--provider`.
|
`--voice`, `--lang`, `--provider`.
|
||||||
|
|||||||
@@ -112,6 +112,15 @@ var commands = []command{
|
|||||||
detail: "Asks a few questions for what talk needs to get going: keys (optional; without a key the free Edge voice speaks), a voice per language with preview, quiet hours, and writes config.toml (an existing file is merged, backup .bak). Without a terminal: only shows the effective configuration.",
|
detail: "Asks a few questions for what talk needs to get going: keys (optional; without a key the free Edge voice speaks), a voice per language with preview, quiet hours, and writes config.toml (an existing file is merged, backup .bak). Without a terminal: only shows the effective configuration.",
|
||||||
handler: runSetup,
|
handler: runSetup,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "version",
|
||||||
|
short: "show the version",
|
||||||
|
detail: "Prints the version and, when built from git, the commit. Same as `talk --version`; exists so that a bare `talk version` is not spoken as an announcement.",
|
||||||
|
handler: func(_ []string, _ *sayOptions, _ io.Reader, stdout, _ io.Writer) int {
|
||||||
|
fmt.Fprintln(stdout, versionString())
|
||||||
|
return exitOK
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// addSayFlags registers the say flags and binds them to the returned options
|
// addSayFlags registers the say flags and binds them to the returned options
|
||||||
|
|||||||
@@ -52,6 +52,18 @@ func TestVersionDefault(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TestVersionSubcommand: `talk version` prints the version instead of
|
||||||
|
// speaking the word.
|
||||||
|
func TestVersionSubcommand(t *testing.T) {
|
||||||
|
var out, errBuf bytes.Buffer
|
||||||
|
if code := runCLI([]string{"version"}, &out, &errBuf); code != exitOK {
|
||||||
|
t.Fatalf("version: exit code = %d, stderr %q", code, errBuf.String())
|
||||||
|
}
|
||||||
|
if got, want := out.String(), versionString()+"\n"; got != want {
|
||||||
|
t.Errorf("version output = %q, want %q", got, want)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestVersionStringWithCommit(t *testing.T) {
|
func TestVersionStringWithCommit(t *testing.T) {
|
||||||
oldCommit := commit
|
oldCommit := commit
|
||||||
commit = "c0ffee1"
|
commit = "c0ffee1"
|
||||||
|
|||||||
Reference in new issue
Block a user