Skip to content

Commit

Permalink
Drop unused config bits
Browse files Browse the repository at this point in the history
  • Loading branch information
bruceg committed Jan 5, 2023
1 parent 15c6d6c commit a38d183
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 32 deletions.
3 changes: 0 additions & 3 deletions vdev/src/commands/config/set/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use anyhow::Result;
use clap::{Args, Subcommand};

mod org;
mod repo;

/// Modify the config file
Expand All @@ -14,14 +13,12 @@ pub struct Cli {

#[derive(Subcommand, Debug)]
enum Commands {
Org(org::Cli),
Repo(repo::Cli),
}

impl Cli {
pub fn exec(&self) -> Result<()> {
match &self.command {
Commands::Org(cli) => cli.exec(),
Commands::Repo(cli) => cli.exec(),
}
}
Expand Down
1 change: 0 additions & 1 deletion vdev/src/commands/meta/starship.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ impl Cli {
}
};

contexts.push(format!("org: {}", app::config().org));
display!("vector{{ {} }}", contexts.join(", "));

Ok(())
Expand Down
29 changes: 1 addition & 28 deletions vdev/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,40 +1,13 @@
use anyhow::{Context, Result};
use serde::{Deserialize, Serialize};
use std::collections::BTreeMap;
use std::path::PathBuf;

const APP_NAME: &str = "vdev";
const FILE_STEM: &str = "config";

#[derive(Serialize, Deserialize, Clone, Debug)]
#[derive(Serialize, Deserialize, Clone, Debug, Default)]
pub struct Config {
pub repo: String,
pub org: String,
pub orgs: BTreeMap<String, OrgConfig>,
}

#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct OrgConfig {
pub api_key: String,
}

impl Default for Config {
fn default() -> Self {
let default_org = "default".to_string();
let mut orgs = BTreeMap::new();
orgs.insert(
default_org.clone(),
OrgConfig {
api_key: String::new(),
},
);

Self {
repo: "".to_string(),
org: default_org,
orgs,
}
}
}

pub fn path() -> Result<PathBuf> {
Expand Down

0 comments on commit a38d183

Please sign in to comment.