forked from containers/common
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request containers#2 from flouthoc/main
cli: Integrate clap and bootstrap initial command structure.
- Loading branch information
Showing
10 changed files
with
391 additions
and
1 deletion.
There are no files selected for viewing
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 @@ | ||
bin |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[package] | ||
name = "netavark" | ||
version = "0.0.1" | ||
edition = "2018" | ||
authors = ["github.com/containers"] | ||
description = "A container network stack" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
clap = "3.0.0-beta.4" |
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,28 @@ | ||
# TODO: Make this more configurable | ||
#prog :=xnixperms | ||
|
||
debug ?= | ||
|
||
$(info debug is $(debug)) | ||
|
||
ifdef debug | ||
release := | ||
target :=debug | ||
extension :=debug | ||
else | ||
release :=--release | ||
target :=release | ||
extension := | ||
endif | ||
|
||
build: | ||
cargo build $(release) --target-dir bin | ||
cp bin/$(target)/netavark bin/netavark | ||
|
||
clean: | ||
rm -rf bin | ||
|
||
all: build | ||
|
||
help: | ||
@echo "usage: make $(prog) [debug=1]" |
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,2 @@ | ||
pub mod setup; | ||
pub mod teardown; |
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,23 @@ | ||
//! Configures the given network namespace with provided specs | ||
use std::path::PathBuf; | ||
use clap::{self, Clap}; | ||
|
||
#[derive(Clap, Debug)] | ||
pub struct Setup { | ||
/// Network namespace path | ||
#[clap(forbid_empty_values = true, required = true)] | ||
network_namespace_path: String, | ||
} | ||
|
||
impl Setup { | ||
/// The setup command configures the given network namespace with the given configuration, creating any interfaces and firewall rules necessary. | ||
pub fn new(network_namespace_path: String) -> Self { | ||
Self { | ||
network_namespace_path, | ||
} | ||
} | ||
|
||
pub fn exec(&self, input_file: PathBuf) { | ||
() | ||
} | ||
} |
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,22 @@ | ||
use std::path::PathBuf; | ||
use clap::{self, Clap}; | ||
|
||
#[derive(Clap, Debug)] | ||
pub struct Teardown { | ||
/// Network namespace path | ||
#[clap(forbid_empty_values = true, required = true)] | ||
network_namespace_path: String, | ||
} | ||
|
||
impl Teardown { | ||
/// The teardown command is the inverse of the setup command, undoing any configuration applied. Some interfaces may not be deleted (bridge interfaces, for example, will not be removed). | ||
pub fn new(network_namespace_path: String) -> Self { | ||
Self { | ||
network_namespace_path, | ||
} | ||
} | ||
|
||
pub fn exec(&self, input_file: PathBuf) { | ||
() | ||
} | ||
} |
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 @@ | ||
pub mod commands; |
Oops, something went wrong.