feat: shorten default configuration flag to --default-config
This commit is contained in:
@@ -55,7 +55,7 @@ struct PlayerCommandChecks {
|
|||||||
guard case .help = try PlayerCommand.parse(["--new-instance", "--help"]) else {
|
guard case .help = try PlayerCommand.parse(["--new-instance", "--help"]) else {
|
||||||
fatalError("FAIL: help must not launch an independent player")
|
fatalError("FAIL: help must not launch an independent player")
|
||||||
}
|
}
|
||||||
guard case .printDefaultConfig = try PlayerCommand.parse(["--print-default-config"]) else {
|
guard case .printDefaultConfig = try PlayerCommand.parse(["--default-config"]) else {
|
||||||
fatalError("FAIL: printing defaults must not launch a player")
|
fatalError("FAIL: printing defaults must not launch a player")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +65,8 @@ struct PlayerCommandChecks {
|
|||||||
["--new-instance", "--new-instance"], ["--new-instance", "--url"],
|
["--new-instance", "--new-instance"], ["--new-instance", "--url"],
|
||||||
["--new-instance", "--"], ["--new-instance", movie.path, movie.path],
|
["--new-instance", "--"], ["--new-instance", movie.path, movie.path],
|
||||||
["--new-instance", "--unknown"], ["--no-config", "--no-config"],
|
["--new-instance", "--unknown"], ["--no-config", "--no-config"],
|
||||||
["--print-default-config", movie.path], ["--print-default-config", "--print-default-config"],
|
["--default-config", movie.path], ["--default-config", "--default-config"],
|
||||||
|
["--print-default-config"],
|
||||||
["--no-config", "--new-instance", "--no-config"]] {
|
["--no-config", "--new-instance", "--no-config"]] {
|
||||||
do {
|
do {
|
||||||
_ = try PlayerCommand.parse(arguments, directory: directory)
|
_ = try PlayerCommand.parse(arguments, directory: directory)
|
||||||
|
|||||||
@@ -49,14 +49,14 @@ The declared app executable stays running after preflight and loads `Contents/Fr
|
|||||||
.build/terebi --new-instance --url 'https://www.youtube.com/watch?v=jNQXAC9IVRw'
|
.build/terebi --new-instance --url 'https://www.youtube.com/watch?v=jNQXAC9IVRw'
|
||||||
.build/terebi --new-instance --no-config "/path/to/video.mp4"
|
.build/terebi --new-instance --no-config "/path/to/video.mp4"
|
||||||
.build/terebi --help
|
.build/terebi --help
|
||||||
.build/terebi --print-default-config
|
.build/terebi --default-config
|
||||||
```
|
```
|
||||||
|
|
||||||
One local file (including a local `file://` URL) or YouTube video URL is accepted. Paths are relative to the shell's current directory; quote spaces and URL query strings. `--` treats the following argument as a filename. With no arguments, the CLI opens or activates the player without replacing its media. Put **`--new-instance` before the media arguments** to launch a separate player process/window instead: it works without media, with a local file or positional YouTube URL, and with `--url` or `--`. Existing playback stays untouched. To use `terebi` by name, add the build directory to your shell's PATH: `export PATH="$PWD/.build:$PATH"`.
|
One local file (including a local `file://` URL) or YouTube video URL is accepted. Paths are relative to the shell's current directory; quote spaces and URL query strings. `--` treats the following argument as a filename. With no arguments, the CLI opens or activates the player without replacing its media. Put **`--new-instance` before the media arguments** to launch a separate player process/window instead: it works without media, with a local file or positional YouTube URL, and with `--url` or `--`. Existing playback stays untouched. To use `terebi` by name, add the build directory to your shell's PATH: `export PATH="$PWD/.build:$PATH"`.
|
||||||
|
|
||||||
The launcher finds `terebi.app` beside its own executable, following symlinks. By default, macOS application/URL delivery reuses a running player and its existing window. With `--new-instance`, one fresh application launch carries any media URL as a startup argument, so it reaches that process without a second app launch or changing another player's media. Keep the executable and app bundle together; this is not a standalone distribution. Media opens use the same autoplay and saved-progress behavior as the UI. Instances share saved progress, but configuration and control overrides belong to each session. Quit all running players after installing this update so every process uses the updated configuration/startup handling.
|
The launcher finds `terebi.app` beside its own executable, following symlinks. By default, macOS application/URL delivery reuses a running player and its existing window. With `--new-instance`, one fresh application launch carries any media URL as a startup argument, so it reaches that process without a second app launch or changing another player's media. Keep the executable and app bundle together; this is not a standalone distribution. Media opens use the same autoplay and saved-progress behavior as the UI. Instances share saved progress, but configuration and control overrides belong to each session. Quit all running players after installing this update so every process uses the updated configuration/startup handling.
|
||||||
|
|
||||||
Help and `--print-default-config` exit with status **0** without opening the GUI, reading configuration, or checking/loading FFmpeg. The latter prints complete built-in TOML to stdout, including every named key action and explicit `[]` entries for unbound actions; it uses the player's authoritative defaults rather than your current settings. It accepts no media argument and never creates or writes a config file. Invalid arguments, unsupported URLs, missing media files, and directories report to stderr and exit **64**; unavailable FFmpeg libraries and application-launch failures exit **69**; unreadable or invalid configuration exits **78** with the file path and diagnostic. A successful launch exits **0** immediately after macOS accepts the request, not when playback finishes. Later extraction/decoding failures appear in the player window; this is a GUI launcher, not a headless player or remote playback-control interface.
|
Help and `--default-config` exit with status **0** without opening the GUI, reading configuration, or checking/loading FFmpeg. The latter prints complete built-in TOML to stdout, including every named key action and explicit `[]` entries for unbound actions; it uses the player's authoritative defaults rather than your current settings. It accepts no media argument and never creates or writes a config file. Invalid arguments, unsupported URLs, missing media files, and directories report to stderr and exit **64**; unavailable FFmpeg libraries and application-launch failures exit **69**; unreadable or invalid configuration exits **78** with the file path and diagnostic. A successful launch exits **0** immediately after macOS accepts the request, not when playback finishes. Later extraction/decoding failures appear in the player window; this is a GUI launcher, not a headless player or remote playback-control interface.
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ enum PlayerCommand {
|
|||||||
terebi [--new-instance] [--no-config] --url YOUTUBE_URL
|
terebi [--new-instance] [--no-config] --url YOUTUBE_URL
|
||||||
terebi [--new-instance] [--no-config] -- FILE
|
terebi [--new-instance] [--no-config] -- FILE
|
||||||
terebi --help
|
terebi --help
|
||||||
terebi --print-default-config
|
terebi --default-config
|
||||||
|
|
||||||
Open one local media file or YouTube video and start playback, resuming saved
|
Open one local media file or YouTube video and start playback, resuming saved
|
||||||
video progress when available. With no arguments, open or activate the player.
|
video progress when available. With no arguments, open or activate the player.
|
||||||
@@ -21,7 +21,7 @@ enum PlayerCommand {
|
|||||||
--url URL Open a YouTube video URL.
|
--url URL Open a YouTube video URL.
|
||||||
-- Treat the following argument as a filename, even with a leading '-'.
|
-- Treat the following argument as a filename, even with a leading '-'.
|
||||||
-h, --help Show this help without launching the player.
|
-h, --help Show this help without launching the player.
|
||||||
--print-default-config Print the complete built-in TOML without launching.
|
--default-config Print the complete built-in TOML without launching.
|
||||||
|
|
||||||
Reuses the running player unless --new-instance is supplied before the media
|
Reuses the running player unless --new-instance is supplied before the media
|
||||||
arguments. The command exits once macOS accepts the launch; playback and
|
arguments. The command exits once macOS accepts the launch; playback and
|
||||||
@@ -44,7 +44,7 @@ enum PlayerCommand {
|
|||||||
}
|
}
|
||||||
if inputs.isEmpty { return .launch(nil, newInstance: newInstance, noConfig: noConfig) }
|
if inputs.isEmpty { return .launch(nil, newInstance: newInstance, noConfig: noConfig) }
|
||||||
if inputs == ["--help"] || inputs == ["-h"] { return .help }
|
if inputs == ["--help"] || inputs == ["-h"] { return .help }
|
||||||
if inputs == ["--print-default-config"] { return .printDefaultConfig }
|
if inputs == ["--default-config"] { return .printDefaultConfig }
|
||||||
if inputs.first == "--url" {
|
if inputs.first == "--url" {
|
||||||
guard inputs.count == 2 else { throw ArgumentError("--url requires exactly one YouTube URL.") }
|
guard inputs.count == 2 else { throw ArgumentError("--url requires exactly one YouTube URL.") }
|
||||||
return .launch(try YouTubeResolver.validateURL(inputs[1]), newInstance: newInstance, noConfig: noConfig)
|
return .launch(try YouTubeResolver.validateURL(inputs[1]), newInstance: newInstance, noConfig: noConfig)
|
||||||
|
|||||||
Reference in New Issue
Block a user