This repository has been archived by the owner on Jul 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
guni1192
committed
Mar 16, 2019
1 parent
4ec2301
commit 54b87f7
Showing
4 changed files
with
96 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,4 @@ dirs = "1.0" | |
log = "0.4" | ||
env_logger = "0.6.0" | ||
rand = "0.6" | ||
prettytable-rs = "^0.8" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use std::path::Path; | ||
|
||
use clap::ArgMatches; | ||
use prettytable::{Cell, Row, Table}; | ||
|
||
use nix::unistd::Pid; | ||
|
||
pub fn show(sub_m: &ArgMatches) { | ||
// Create the table | ||
let mut table = Table::new(); | ||
|
||
table.add_row(row!["Container ID", "PID"]); | ||
for i in 0..3 { | ||
let pidfile = Pidfile::read(Path::new("/hoge")); | ||
table.add_row(row![pidfile.name, pidfile.pid]); | ||
} | ||
|
||
table.printstd(); | ||
} | ||
|
||
struct Pidfile { | ||
pid: Pid, | ||
name: String, | ||
} | ||
|
||
impl Pidfile { | ||
fn read(path: &Path) -> Self { | ||
Pidfile { | ||
pid: Pid::from_raw(1000), | ||
name: "library/alpine:latest".to_string(), | ||
} | ||
} | ||
} |