Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
Tenjin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nawasan Wisitsingkhon
Tenjin
Commits
4a48f39c
Commit
4a48f39c
authored
Aug 25, 2024
by
Nawasan Wisitsingkhon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add generate auto complete for shell
parent
966347a0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
7 deletions
+25
-7
Cargo.lock
Cargo.lock
+14
-4
Cargo.toml
Cargo.toml
+1
-0
cli_system.rs
src/cli/cli_system.rs
+10
-3
No files found.
Cargo.lock
View file @
4a48f39c
...
...
@@ -59,9 +59,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
name = "clap"
version = "4.5.1
3
"
version = "4.5.1
6
"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "
0fbb260a053428790f3de475e304ff84cdbc4face759ea7a3e64c1edd938a7fc
"
checksum = "
ed6719fffa43d0d87e5fd8caeab59be1554fb028cd30edc88fc4369b17971019
"
dependencies = [
"clap_builder",
"clap_derive",
...
...
@@ -69,9 +69,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.5.1
3
"
version = "4.5.1
5
"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "
64b17d7ea74e9f833c7dbf2cbe4fb12ff26783eda4782a8975b72f895c9b4d99
"
checksum = "
216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6
"
dependencies = [
"anstream",
"anstyle",
...
...
@@ -79,6 +79,15 @@ dependencies = [
"strsim",
]
[[package]]
name = "clap_complete"
version = "4.5.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "531d7959c5bbb6e266cecdd0f20213639c3a5c3e4d615f97db87661745f781ff"
dependencies = [
"clap",
]
[[package]]
name = "clap_derive"
version = "4.5.13"
...
...
@@ -156,6 +165,7 @@ version = "0.3.2"
dependencies = [
"byteorder",
"clap",
"clap_complete",
]
[[package]]
...
...
Cargo.toml
View file @
4a48f39c
...
...
@@ -23,6 +23,7 @@ path = "src/main.rs"
[dependencies]
byteorder
=
"1.0.0"
clap
=
{
version
=
"4.5.13"
,
features
=
["derive"]
}
clap_complete
=
"4.5.23"
[profile.release]
strip
=
true
src/cli/cli_system.rs
View file @
4a48f39c
...
...
@@ -2,8 +2,9 @@ use crate::{
example
::{
Controller10
,
Controller13
},
openflow
::{
ofp10
::
ControllerFrame10
,
ofp13
::
ControllerFrame13
},
};
use
clap
::{
command
,
Parser
,
Subcommand
};
use
std
::
thread
;
use
clap
::{
command
,
CommandFactory
,
Parser
,
Subcommand
};
use
clap_complete
::{
generate
,
Shell
};
use
std
::{
io
,
thread
};
#[derive(Parser)]
#[command(name
=
"tenjin"
,author,
version,
about,
long_about
=
None)]
...
...
@@ -13,7 +14,7 @@ struct Cli {
}
#[derive(Subcommand)]
pub
enum
Commands
{
enum
Commands
{
/// Run the controller
Run
{
#[command(subcommand)]
...
...
@@ -29,6 +30,8 @@ pub enum Commands {
)]
listen
:
String
,
},
/// Generate auto complete for shell
Generate
{
shell
:
Shell
},
}
#[derive(Subcommand)]
...
...
@@ -69,5 +72,9 @@ pub fn system() {
let
_
=
th
.join
();
}
}
Commands
::
Generate
{
shell
}
=>
{
let
mut
cli_gen
=
Cli
::
command
();
generate
(
shell
,
&
mut
cli_gen
,
"tenjin"
,
&
mut
io
::
stdout
());
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment