Skip to content

Commit 20bf8a5

Browse files
author
Heiko Alexander Weber
committed
#patch | bugfixes
1 parent 23c9e13 commit 20bf8a5

8 files changed

Lines changed: 40 additions & 38 deletions

File tree

.complate/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ templates:
3131
options:
3232
- security
3333
- command::print
34-
- backend::cli
35-
- backend::ui
34+
- backend+cli
35+
- backend+ui
3636
- misc

.github/workflows/pipeline.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ jobs:
1515
features: ""
1616
- name: "all"
1717
features: --all-features
18-
- name: "backend::ui"
19-
features: --features "backend::ui" --no-default-features
18+
- name: "backend+ui"
19+
features: --features "backend+ui" --no-default-features
2020
steps:
2121
- uses: actions/checkout@v1
2222
- name: Install tools
@@ -97,8 +97,10 @@ jobs:
9797
include:
9898
- os: macos-latest
9999
target: x86_64-apple-darwin
100+
install: printf ok
100101
- os: ubuntu-latest
101102
target: x86_64-unknown-linux-gnu
103+
install: sudo apt-get install build-essential libncurses5-dev libncursesw5-dev
102104
steps:
103105
- uses: actions/checkout@v1
104106
- name: Get version
@@ -113,7 +115,7 @@ jobs:
113115
run: echo ::set-output name=upload_url::$(cat RELEASE/${{ env.RELEASE_FILE }})
114116
- name: install tools
115117
run: |
116-
sudo apt-get install build-essential libncurses5-dev libncursesw5-dev &&
118+
${{ matrix.install }} &&
117119
rustup target install ${{ matrix.target }}
118120
- name: build-${{ matrix.target }}
119121
run: |

.vscode/settings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"rust-analyzer.cargo.features": [
3-
"backend::cli",
4-
"backend::ui",
3+
"backend+cli",
4+
"backend+ui",
55
]
66
}

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ keywords = ["cli", "template", "replace", "standardizing"]
1212
categories = ["command-line-utilities"]
1313

1414
[features]
15-
default = ["backend::cli"]
16-
"backend::cli" = ["dialoguer"]
17-
"backend::ui" = ["cursive", "fui"]
15+
default = ["backend+cli"]
16+
"backend+cli" = ["dialoguer"]
17+
"backend+ui" = ["cursive", "fui"]
1818

1919
[profile]
2020
[dev]

docs/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ All features that are marked as `experimental` are _not_ considered a public API
5555

5656
|Name|Description|Default|
5757
|-- |-- |-- |
58-
|backend::cli|The CLI backend which maps to the original dialoguer implementation.|Yes|
58+
|backend+cli|The CLI backend which maps to the original dialoguer implementation.|Yes|
5959
|baclend::ui|The UI backend which maps to the new cursive/fui implementation.|No|
6060

61-
#### `backend::`
61+
#### `backend+`
6262

63-
Either one of the `backend::` flags (or both) MUST be enabled for `complate` to work (it won't compile otherwise).
63+
Either one of the `backend+` flags (or both) MUST be enabled for `complate` to work (it won't compile otherwise).
6464

6565
### Application level arguments
6666

@@ -81,7 +81,7 @@ Either one of the `backend::` flags (or both) MUST be enabled for `complate` to
8181
|-- |-- |-- |-- |-- |
8282
|Config file path|-c|--config|The path to the configuration file that shall be used. This path can be relative or absolute. The default path is `./complate/config.yml`.|stable|
8383
|Shell trust||--shell-trust|Enables the shell value provider for replacing template placeholders. Due to the potential security risk with this option, it is disabled by default. Possible values for this option are `none` (default), `prompt` and `ultimate`|stable|
84-
|Backend|-b|--backend|Defines the backend for the user interaction.|`CLI` is stable. `UI` is experimental (feature = "backend::ui").|
84+
|Backend|-b|--backend|Defines the backend for the user interaction.|`CLI` is stable. `UI` is experimental (feature = "backend+ui").|
8585

8686
### Configuration file
8787

@@ -120,8 +120,8 @@ templates:
120120
options:
121121
- security
122122
- command::print
123-
- backend::cli
124-
- backend::ui
123+
- backend+cli
124+
- backend+ui
125125
- misc
126126
127127
```

src/args/mod.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ impl CallArgs {
1111
match self.privileges {
1212
Privilege::Normal => match &self.command {
1313
Command::Print(args) => match args.backend {
14-
#[cfg(feature = "backend::cli")]
14+
#[cfg(feature = "backend+cli")]
1515
Backend::CLI => Ok(()),
16-
#[cfg(feature = "backend::ui")]
16+
#[cfg(feature = "backend+ui")]
1717
Backend::UI => Err(std::io::Error::new(
1818
std::io::ErrorKind::Other,
19-
"can not use backend::ui without experimental features being activated",
19+
"can not use backend+ui without experimental features being activated",
2020
)),
2121
},
2222
_ => Ok(()),
@@ -49,9 +49,9 @@ pub enum ShellTrust {
4949
}
5050

5151
pub enum Backend {
52-
#[cfg(feature = "backend::cli")]
52+
#[cfg(feature = "backend+cli")]
5353
CLI,
54-
#[cfg(feature = "backend::ui")]
54+
#[cfg(feature = "backend+ui")]
5555
UI,
5656
}
5757

@@ -60,10 +60,10 @@ pub struct ClapArgumentLoader {}
6060
impl ClapArgumentLoader {
6161
pub async fn load_from_cli() -> std::io::Result<CallArgs> {
6262
let mut backend_values = Vec::new();
63-
if cfg!(feature = "backend::cli") {
63+
if cfg!(feature = "backend+cli") {
6464
backend_values.push("cli");
6565
}
66-
if cfg!(feature = "backend::ui") {
66+
if cfg!(feature = "backend+ui") {
6767
backend_values.push("ui");
6868
}
6969

@@ -140,9 +140,9 @@ impl ClapArgumentLoader {
140140

141141
let backend = match x.value_of("backend") {
142142
Some(x) => match x {
143-
#[cfg(feature = "backend::cli")]
143+
#[cfg(feature = "backend+cli")]
144144
"cli" => Backend::CLI,
145-
#[cfg(feature = "backend::ui")]
145+
#[cfg(feature = "backend+ui")]
146146
"ui" => Backend::UI,
147147
_ => {
148148
return Err(std::io::Error::new(
@@ -151,9 +151,9 @@ impl ClapArgumentLoader {
151151
))
152152
}
153153
},
154-
#[cfg(feature = "backend::cli")]
154+
#[cfg(feature = "backend+cli")]
155155
None => Backend::CLI,
156-
#[cfg(feature = "backend::ui")]
156+
#[cfg(feature = "backend+ui")]
157157
#[allow(unreachable_patterns)]
158158
None => Backend::UI,
159159
};

src/main.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
#[cfg(not(feature = "backend::cli"))]
2-
#[cfg(not(feature = "backend::ui"))]
1+
#[cfg(not(feature = "backend+cli"))]
2+
#[cfg(not(feature = "backend+ui"))]
33
extern crate DO_NOT_COMPILE_WITHOUT_ANY_ENABLED_BACKEND;
44

55
extern crate clap;
6-
#[cfg(feature = "backend::ui")]
6+
#[cfg(feature = "backend+ui")]
77
extern crate cursive;
8-
#[cfg(feature = "backend::cli")]
8+
#[cfg(feature = "backend+cli")]
99
extern crate dialoguer;
10-
#[cfg(feature = "backend::ui")]
10+
#[cfg(feature = "backend+ui")]
1111
extern crate fui;
1212
extern crate handlebars;
1313
extern crate serde;
@@ -147,8 +147,8 @@ templates:
147147
options:
148148
- security
149149
- command::print
150-
- backend::cli
151-
- backend::ui
150+
- backend+cli
151+
- backend+ui
152152
- misc
153153
154154
"###

src/print/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ pub trait UserInput: Send + Sync {
1919
impl Backend {
2020
pub fn to_input(&self) -> Result<Box<dyn UserInput>> {
2121
Ok(match self {
22-
#[cfg(feature = "backend::cli")]
22+
#[cfg(feature = "backend+cli")]
2323
Backend::CLI => Box::new(cli::CLIBackend::new()) as Box<dyn UserInput>,
24-
#[cfg(feature = "backend::ui")]
24+
#[cfg(feature = "backend+ui")]
2525
Backend::UI => Box::new(ui::UIBackend::new()) as Box<dyn UserInput>,
2626
})
2727
}
@@ -69,7 +69,7 @@ async fn shell(command: &str, shell_trust: &ShellTrust, backend: &Backend) -> Re
6969
Ok(String::from_utf8(output.stdout).unwrap())
7070
}
7171

72-
#[cfg(feature = "backend::cli")]
72+
#[cfg(feature = "backend+cli")]
7373
mod cli {
7474
use super::UserInput;
7575
use async_trait::async_trait;
@@ -129,7 +129,7 @@ mod cli {
129129
}
130130
}
131131

132-
#[cfg(feature = "backend::ui")]
132+
#[cfg(feature = "backend+ui")]
133133
mod ui {
134134
use super::UserInput;
135135
use async_trait::async_trait;

0 commit comments

Comments
 (0)