Skip to content

Commit

Permalink
Merge pull request #684 from ukautz/feature/disable-repo-management
Browse files Browse the repository at this point in the history
Add build feature to disable repo management
  • Loading branch information
denisidoro authored Feb 9, 2022
2 parents f86f9dd + b5b79b4 commit 6a76afc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ license = "Apache-2.0"

[features]
disable-command-execution = []
disable-repo-management = []

[badges]
travis-ci = { repository = "denisidoro/navi", branch = "master" }
Expand Down
1 change: 1 addition & 0 deletions src/config/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ pub enum Command {
args: Vec<String>,
},
/// Manages cheatsheet repositories
#[cfg(not(feature = "disable-repo-management"))]
Repo {
#[clap(subcommand)]
cmd: RepoCommand,
Expand Down
5 changes: 4 additions & 1 deletion src/handler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ pub mod repo_add;
pub mod repo_browse;
pub mod shell;

use crate::config::Command::{Fn, Info, Preview, PreviewVar, PreviewVarStdin, Repo, Widget};
#[cfg(not(feature = "disable-repo-management"))]
use crate::config::Command::Repo;
use crate::config::Command::{Fn, Info, Preview, PreviewVar, PreviewVarStdin, Widget};
use crate::config::{RepoCommand, CONFIG};
use crate::handler;
use anyhow::Context;
Expand Down Expand Up @@ -38,6 +40,7 @@ pub fn handle() -> Result<()> {
handler::info::main(info).with_context(|| format!("Failed to fetch info `{:#?}`", info))
}

#[cfg(not(feature = "disable-repo-management"))]
Repo { cmd } => match cmd {
RepoCommand::Add { uri } => {
handler::repo_add::main(uri.clone())
Expand Down

0 comments on commit 6a76afc

Please sign in to comment.