Co-authored-by: Arekatla Nishanth Chowdary <av.sc.u4aie23002@av.students.amrita.edu>
This commit is contained in:
1 parent
c1e1a0d186
commit
8e8ceccab9
5 files changed
+1134
-3
No files matched your search
@@ -190,6 +190,7 @@ Kiri's own commands:
|
||||
| `kiri usb [list [--json]] \| attach DEVICE \| detach DEVICE` | USB devices for containers (beta) |
|
||||
| `kiri build-with [docker \| kiri]` | Which builder `docker build` uses |
|
||||
| `kiri update [--check]` | Install the newest release |
|
||||
| `kiri doctor [--json]` | Whether Kiri works here, one line per part, and what to run when one doesn't |
|
||||
| `kiri diag logs \| report` | Logs, and a report file to send with a bug |
|
||||
| `kiri bench [--runs N] [--network none\|bridge]` | Measure container start on your machine |
|
||||
| `kiri ui` | Open the window |
|
||||
|
||||
@@ -188,6 +188,7 @@ Kiri 自有命令:
|
||||
| `kiri usb [list [--json]] \| attach DEVICE \| detach DEVICE` | 容器的 USB 设备(beta) |
|
||||
| `kiri build-with [docker \| kiri]` | 选择 `docker build` 使用的构建器 |
|
||||
| `kiri update [--check]` | 安装最新版本 |
|
||||
| `kiri doctor [--json]` | 检查 Kiri 各组件是否正常工作,异常时给出修复命令 |
|
||||
| `kiri diag logs \| report` | 日志,以及随 bug 报告提交的报告文件 |
|
||||
| `kiri bench [--runs N] [--network none\|bridge]` | 在你的机器上测量容器启动速度 |
|
||||
| `kiri ui` | 打开窗口 |
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
+11
-1
@@ -44,6 +44,9 @@ mod docker;
|
||||
#[cfg(any(target_os = "macos", all(target_os = "linux", feature = "window"), test))]
|
||||
#[cfg_attr(not(any(target_os = "macos", all(target_os = "linux", feature = "window"))), allow(dead_code))]
|
||||
mod dockerctx;
|
||||
// `kiri doctor`: whether this installation works (Windows: docker here, the engine in WSL).
|
||||
#[cfg(any(unix, windows))]
|
||||
mod doctor;
|
||||
// `kiri domains`: the container-domain routers' ports (Windows: in WSL).
|
||||
#[cfg(unix)]
|
||||
mod domains_cli;
|
||||
@@ -116,6 +119,7 @@ const USAGE_LINES: &[&str] = &[
|
||||
" kiri update [--check] update Kiri (with a container: docker's update)",
|
||||
#[cfg(target_os = "linux")]
|
||||
" kiri update --check check for a newer Kiri (with a container: docker's update)",
|
||||
" kiri doctor [--json] whether Kiri works here, and what to run when a part doesn't",
|
||||
" kiri diag logs [-f] [--ui|--engine|--cli] [--errors] [-n N]",
|
||||
" kiri diag report [--out PATH] [--send] (a file to send us, tokens taken out)",
|
||||
" kiri PORT [NAME] share a local port on the internet (same as kiri share PORT)",
|
||||
@@ -180,6 +184,8 @@ enum Command<'a> {
|
||||
BuildWith(&'a [String]),
|
||||
#[cfg(unix)]
|
||||
Domains(&'a [String]),
|
||||
#[cfg(any(unix, windows))]
|
||||
Doctor(&'a [String]),
|
||||
#[cfg(unix)]
|
||||
Storage(&'a [String]),
|
||||
#[cfg(unix)]
|
||||
@@ -250,6 +256,8 @@ impl<'a> Command<'a> {
|
||||
Some("build-with") => Some(Command::BuildWith(&args[1..])),
|
||||
#[cfg(unix)]
|
||||
Some("domains") => Some(Command::Domains(&args[1..])),
|
||||
#[cfg(any(unix, windows))]
|
||||
Some("doctor") => Some(Command::Doctor(&args[1..])),
|
||||
#[cfg(unix)]
|
||||
Some("storage") => Some(Command::Storage(&args[1..])),
|
||||
#[cfg(unix)]
|
||||
@@ -336,6 +344,8 @@ fn main() -> ExitCode {
|
||||
Some(Command::BuildWith(rest)) => buildwith::cli(rest),
|
||||
#[cfg(unix)]
|
||||
Some(Command::Domains(rest)) => domains_cli::run(rest),
|
||||
#[cfg(any(unix, windows))]
|
||||
Some(Command::Doctor(rest)) => doctor::run(rest),
|
||||
#[cfg(unix)]
|
||||
Some(Command::Storage(rest)) => storage_cli::run(rest),
|
||||
#[cfg(unix)]
|
||||
@@ -497,7 +507,7 @@ mod tests {
|
||||
fn usage_lists_only_commands_for_this_os() {
|
||||
let help = usage();
|
||||
let cmds = advertised_subcommands(&help);
|
||||
for common in ["COMMAND", "start", "domains", "storage", "registry", "scan", "diag", "PORT", "share", "k8s", "usb", "machine"] {
|
||||
for common in ["COMMAND", "start", "doctor", "domains", "storage", "registry", "scan", "diag", "PORT", "share", "k8s", "usb", "machine"] {
|
||||
assert!(cmds.contains(&common), "help missing `{common}`:\n{help}");
|
||||
}
|
||||
assert!(help.contains("kiri storage [status | reclaim]"), "help missing `kiri storage`:\n{help}");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
//! `kiri k8s`, `kiri machine`, `kiri diag`, `kiri usb`, `kiri domains`,
|
||||
//! `kiri registry` and `kiri scan` on Windows: the engine's own
|
||||
//! `kiri registry`, `kiri scan` and `kiri storage` on Windows (and the
|
||||
//! engine's half of `kiri doctor`, doctor.rs): the engine's own
|
||||
//! commands, run by the Linux `kiri` in the WSL distro Kiri's engine lives
|
||||
//! in, as the engine runs (root, with its HOME), so it finds the daemon's
|
||||
//! socket and store. `kiri diag report [--out PATH]` writes the report file
|
||||
@@ -335,7 +336,7 @@ pub fn run(args: &[String]) -> io::Result<()> {
|
||||
}
|
||||
|
||||
/// The distro setup put the engine in (crates/kiri-win/src/setup.rs).
|
||||
fn distro() -> Option<String> {
|
||||
pub(crate) fn distro() -> Option<String> {
|
||||
let dir = PathBuf::from(std::env::var_os("LOCALAPPDATA")?).join("Kiri");
|
||||
let v: serde_json::Value = serde_json::from_slice(&std::fs::read(dir.join("setup.json")).ok()?).ok()?;
|
||||
v["distro"].as_str().map(str::to_owned)
|
||||
|
||||
Reference in new issue
Block a user