Skip to content

Commit

Permalink
printing current working path
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramilito committed Sep 3, 2022
1 parent 7ff1682 commit 6f8d351
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
19 changes: 19 additions & 0 deletions src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,31 @@ use std::process::{Child, Command, Stdio};
#[allow(dead_code)]
pub fn print_themes() {
let printer = PrettyPrinter::new();

println!("Syntaxes:");
for syntax in printer.syntaxes() {
println!("- {} ({})", syntax.name, syntax.file_extensions.join(", "));
}

println!();

println!("Themes:");
for theme in printer.themes() {
println!("- {}", theme);
}
}

pub fn pretty_print_path(string: String) {
PrettyPrinter::new()
.input(Input::from_bytes(&string.as_bytes()))
.header(true)
.grid(true)
.language("syslog")
.theme("OneHalfDark")
.print()
.unwrap();
}

pub fn pretty_print(string: String) {
PrettyPrinter::new()
.input(
Expand Down
5 changes: 4 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ mod commands;
mod settings;

use clap::Parser;
use commands::{get_build, get_diff, pretty_print};
use commands::{get_build, get_diff, pretty_print, pretty_print_path};
use serde::Deserialize;
use serde_yaml::Value;
use settings::Settings;
Expand All @@ -18,10 +18,13 @@ pub struct Cli {
fn main() -> Result<(), io::Error> {
let args = Cli::parse();
let mut settings = Settings::load()?;

settings.configs.env = args.env.unwrap_or_default();
let entry = Settings::get_service_paths(&settings)?;

for path in entry {
pretty_print_path(format!("Path: {}", path.to_string()));

let build = get_build(&path);
for document in serde_yaml::Deserializer::from_str(build.as_str()) {
let v = Value::deserialize(document).unwrap();
Expand Down

0 comments on commit 6f8d351

Please sign in to comment.