Skip to content

Commit aa72c75

Browse files
committed
feat: implement script command
Configure command line parsing. Implemented `chcpu`. mcookie: fix "unused import" warning in test lslocks: add missing #[cfg(target_os = "linux")] build.rs: remove coreutils stuff chore(Cargo.toml): update edition from 2021 to 2024 to leverage new features and improvements style(script.rs): reorder imports for better readability and consistency fix(script.rs): update deprecation warning message formatting for clarity chore(test_script.rs): remove unnecessary trailing whitespace for cleaner code feat(script): add support for the `script` command on Linux systems refactor(script): restructure code to improve readability and maintainability fix(script): update error messages for clarity and consistency test(script): add tests for various functionalities and edge cases in the script command chore(script.rs): remove unnecessary empty line at the end of the file to maintain code cleanliness fix(Cargo.toml): resolve merge conflicts and remove duplicate entries for syscall-numbers dependency fix(chcpu.rs): clean up imports by removing unnecessary duplicate entries for clap crate refactor(script.rs): move uumain function implementation to reduce code duplication and improve maintainability style(Cargo.toml): adjust formatting for alignment and consistency in dependency declarations to enhance readability refactor(script.rs): move uumain function to the correct location for better organization and readability chore(script.rs): remove deprecated code related to the -t option to clean up the codebase and improve maintainability refactor(script.rs): consolidate platform-specific code under a single module for better organization and maintainability feat(script.rs): implement command line argument parsing in the run function to enhance script execution flexibility chore(script.rs): remove unnecessary empty line at the end of the file to maintain code cleanliness fix(script.rs): correct the type casting of TIOCSCTTY in ioctl call to match expected type and prevent potential issues
1 parent 9f24cd1 commit aa72c75

File tree

8 files changed

+981
-3
lines changed

8 files changed

+981
-3
lines changed

Cargo.lock

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ feat_common_core = [
4242
"renice",
4343
"rev",
4444
"setsid",
45+
"script",
4546
]
4647

4748
[workspace.dependencies]
@@ -77,7 +78,7 @@ clap_mangen = { workspace = true }
7778
dns-lookup = { workspace = true }
7879
phf = { workspace = true }
7980
serde = { workspace = true }
80-
serde_json = { workspace = true }
81+
serde_json = { workspace = true }
8182
textwrap = { workspace = true }
8283
uucore = { workspace = true }
8384

@@ -97,11 +98,14 @@ mesg = { optional = true, version = "0.0.1", package = "uu_mesg", path = "src/uu
9798
mountpoint = { optional = true, version = "0.0.1", package = "uu_mountpoint", path = "src/uu/mountpoint" }
9899
renice = { optional = true, version = "0.0.1", package = "uu_renice", path = "src/uu/renice" }
99100
rev = { optional = true, version = "0.0.1", package = "uu_rev", path = "src/uu/rev" }
100-
setsid = { optional = true, version = "0.0.1", package = "uu_setsid", path ="src/uu/setsid" }
101+
setsid = { optional = true, version = "0.0.1", package = "uu_setsid", path = "src/uu/setsid" }
102+
script = { optional = true, version = "0.0.1", package = "uu_script", path = "src/uu/script" }
101103

102104
[dev-dependencies]
103105
# dmesg test require fixed-boot-time feature turned on.
104-
dmesg = { version = "0.0.1", package = "uu_dmesg", path = "src/uu/dmesg", features = ["fixed-boot-time"] }
106+
dmesg = { version = "0.0.1", package = "uu_dmesg", path = "src/uu/dmesg", features = [
107+
"fixed-boot-time",
108+
] }
105109
libc = { workspace = true }
106110
pretty_assertions = "1"
107111
rand = { workspace = true }

src/uu/script/Cargo.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[package]
2+
name = "uu_script"
3+
version = "0.0.1"
4+
edition = "2024"
5+
6+
[dependencies]
7+
uucore = { workspace = true }
8+
clap = { workspace = true }
9+
libc = { workspace = true }
10+
nix = { workspace = true, features = ["term"] }
11+
12+
13+
[lib]
14+
path = "src/script.rs"
15+
16+
[[bin]]
17+
name = "script"
18+
path = "src/main.rs"
19+
20+
[dev-dependencies]
21+
tempfile.workspace = true

src/uu/script/script.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# script
2+
3+
```
4+
script [OPTIONS] [FILE]
5+
```
6+
7+
Make typescript of terminal session

src/uu/script/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
uucore::bin!(uu_script);

0 commit comments

Comments
 (0)