Skip to content

Commit 3764816

Browse files
authored
Merge pull request #294 from xbjfk/uuidgen
Implement uuidgen
2 parents 65959a5 + 1dcb552 commit 3764816

9 files changed

Lines changed: 430 additions & 51 deletions

File tree

Cargo.lock

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

Cargo.toml

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

4748
[workspace.dependencies]
@@ -69,6 +70,8 @@ tempfile = "3.9.0"
6970
textwrap = { version = "0.16.0", features = ["terminal_size"] }
7071
thiserror = "2.0"
7172
uucore = "0.0.30"
73+
uuid = { version = "1.16.0", features = ["rng-rand"] }
74+
windows = { version = "0.61.1" }
7275
xattr = "1.3.1"
7376

7477
[dependencies]
@@ -99,6 +102,7 @@ mountpoint = { optional = true, version = "0.0.1", package = "uu_mountpoint", pa
99102
renice = { optional = true, version = "0.0.1", package = "uu_renice", path = "src/uu/renice" }
100103
rev = { optional = true, version = "0.0.1", package = "uu_rev", path = "src/uu/rev" }
101104
setsid = { optional = true, version = "0.0.1", package = "uu_setsid", path ="src/uu/setsid" }
105+
uuidgen = { optional = true, version = "0.0.1", package = "uu_uuidgen", path ="src/uu/uuidgen" }
102106

103107
[dev-dependencies]
104108
# dmesg test require fixed-boot-time feature turned on.
@@ -109,6 +113,7 @@ rand = { workspace = true }
109113
regex = { workspace = true }
110114
tempfile = { workspace = true }
111115
uucore = { workspace = true, features = ["entries", "process", "signals"] }
116+
uuid = { workspace = true }
112117

113118
[target.'cfg(unix)'.dev-dependencies]
114119
nix = { workspace = true, features = ["term"] }

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ First, reimplement the most important tools from util-linux:
9999
- `ldattach`: Attaches line discipline to a serial line.
100100
- `readprofile`: Reads kernel profiling info.
101101
- `i386, linux32, linux64, x86_64`: Set personality flags for execution environment.
102+
- `uuidgen`: Generate different types of UUID.
102103

103104
Note:
104105
* /bin/more is already implemented in https://github.com/uutils/coreutils

src/uu/uuidgen/Cargo.toml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[package]
2+
name = "uu_uuidgen"
3+
version = "0.0.1"
4+
edition = "2021"
5+
6+
[lib]
7+
path = "src/uuidgen.rs"
8+
9+
[[bin]]
10+
name = "uuidgen"
11+
path = "src/main.rs"
12+
13+
[dependencies]
14+
clap = { workspace = true }
15+
rand = { workspace = true }
16+
thiserror = { workspace = true }
17+
uucore = { workspace = true }
18+
uuid = { workspace = true, features = ["v1", "v3", "v4", "v5"] }
19+
20+
[target.'cfg(target_os = "windows")'.dependencies]
21+
windows = { workspace = true, features = ["Win32_NetworkManagement_IpHelper", "Win32_NetworkManagement_Ndis", "Win32_Networking_WinSock"] }
22+
23+
[target.'cfg(all(target_family = "unix", not(target_os = "redox")))'.dependencies]
24+
nix = { workspace = true, features = ["net"] }

src/uu/uuidgen/src/main.rs

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

0 commit comments

Comments
 (0)