Skip to content

Commit 52193ec

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
1 parent cd747e8 commit 52193ec

File tree

8 files changed

+1002
-23
lines changed

8 files changed

+1002
-23
lines changed

Cargo.lock

Lines changed: 33 additions & 20 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
@@ -41,6 +41,7 @@ feat_common_core = [
4141
"renice",
4242
"rev",
4343
"setsid",
44+
"script",
4445
]
4546

4647
[workspace.dependencies]
@@ -74,7 +75,7 @@ clap_mangen = { workspace = true }
7475
dns-lookup = { workspace = true }
7576
phf = { workspace = true }
7677
serde = { workspace = true }
77-
serde_json = { workspace = true }
78+
serde_json = { workspace = true }
7879
textwrap = { workspace = true }
7980
uucore = { workspace = true }
8081

@@ -93,11 +94,14 @@ mesg = { optional = true, version = "0.0.1", package = "uu_mesg", path = "src/uu
9394
mountpoint = { optional = true, version = "0.0.1", package = "uu_mountpoint", path = "src/uu/mountpoint" }
9495
renice = { optional = true, version = "0.0.1", package = "uu_renice", path = "src/uu/renice" }
9596
rev = { optional = true, version = "0.0.1", package = "uu_rev", path = "src/uu/rev" }
96-
setsid = { optional = true, version = "0.0.1", package = "uu_setsid", path ="src/uu/setsid" }
97+
setsid = { optional = true, version = "0.0.1", package = "uu_setsid", path = "src/uu/setsid" }
98+
script = { optional = true, version = "0.0.1", package = "uu_script", path = "src/uu/script" }
9799

98100
[dev-dependencies]
99101
# dmesg test require fixed-boot-time feature turned on.
100-
dmesg = { version = "0.0.1", package = "uu_dmesg", path = "src/uu/dmesg", features = ["fixed-boot-time"] }
102+
dmesg = { version = "0.0.1", package = "uu_dmesg", path = "src/uu/dmesg", features = [
103+
"fixed-boot-time",
104+
] }
101105
libc = { workspace = true }
102106
pretty_assertions = "1"
103107
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)