Skip to content

Commit 9401aa0

Browse files
authored
Clarify custom shell and self-hosted server usage in README (#308)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
1 parent a5e8221 commit 9401aa0

2 files changed

Lines changed: 44 additions & 16 deletions

File tree

README.md

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,40 @@ scoop install powersession-rs
4242
### Get Help
4343
```console
4444
PS D:\projects\PowerSession> PowerSession.exe -h
45-
PowerSession
45+
Usage: PowerSession [OPTIONS] <COMMAND>
46+
47+
Commands:
48+
rec Record and save a session
49+
play Play a recorded session
50+
auth Authentication with api server (default is asciinema.org)
51+
upload Upload a session to api server
52+
server The url of asciinema server
53+
stream Stream a live terminal session to the asciinema server
54+
help Print this message or the help of the given subcommand(s)
55+
56+
Options:
57+
-l, --log-level <log-level> can be one of [error|warn|info|debug|trace] [default: error]
58+
-h, --help Print help
59+
-V, --version Print version
60+
```
61+
62+
### Record with a specific shell or startup arguments
4663

47-
USAGE:
48-
PowerSession.exe [SUBCOMMAND]
64+
Use `-c` / `--command` to choose the shell explicitly and include any startup arguments you need.
4965

50-
OPTIONS:
51-
-h, --help Print help information
66+
```console
67+
PowerSession.exe rec demo.cast --command "powershell.exe -NoLogo"
68+
PowerSession.exe rec demo.cast --command "pwsh.exe -NoLogo"
69+
```
5270

53-
SUBCOMMANDS:
54-
rec Record and save a session
55-
play
56-
auth Authentication with asciinema.org
57-
upload Upload a session to ascinema.org
58-
help Print this message or the help of the given subcommand(s)
71+
### Use a self-hosted asciinema server
72+
73+
Set the server URL once, then authenticate and upload as usual. The configured server is reused for `auth`, `upload`, and `stream`.
74+
75+
```console
76+
PowerSession.exe server https://asciinema.example.com
77+
PowerSession.exe auth
78+
PowerSession.exe upload demo.cast
5979
```
6080

6181
## Credits

src/commands/api/asciinema.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ struct Config {
2424
}
2525

2626
impl Config {
27+
fn new_config_notice() -> String {
28+
"New config file created \nDefault instance will be used: https://asciinema.org \nTo set a custom server run: PowerSession.exe server <url>\n".to_string()
29+
}
30+
2731
fn get_config_file() -> (PathBuf, PathBuf) {
2832
let app_dirs = AppDirs::new(None, true).unwrap();
2933
let config_root = app_dirs.config_dir.join("PowerSession");
@@ -40,11 +44,7 @@ impl Config {
4044
c.location = config_file.to_str().unwrap().to_owned();
4145
c
4246
} else {
43-
let text = format!(
44-
"New config file created \nDefault instance will be used: https://asciinema.org \nTo set a custom server type: PowerSession.exe --server <hostname>\n"
45-
);
46-
47-
println!("{}", text);
47+
println!("{}", Self::new_config_notice());
4848
return Self::new(None);
4949
};
5050
}
@@ -315,4 +315,12 @@ mod tests {
315315
let expected = format!("Basic {}", BASE64_STANDARD.encode("user:token-123"));
316316
assert_eq!(asc.get_auth_header(), expected);
317317
}
318+
319+
#[test]
320+
fn test_new_config_notice_mentions_server_subcommand() {
321+
let notice = Config::new_config_notice();
322+
323+
assert!(notice.contains("PowerSession.exe server <url>"));
324+
assert!(!notice.contains("--server"));
325+
}
318326
}

0 commit comments

Comments
 (0)