Skip to content

Commit

Permalink
Fix colored output
Browse files Browse the repository at this point in the history
  • Loading branch information
praveenperera committed Nov 13, 2023
1 parent 6c5db43 commit 3567854
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion local-release
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash

cargo build --release;
sudo rm /usr/local/bin/yamine;

sudo rm /usr/local/bin/yamine;
sudo ln -s "$(pwd)/target/release/yamine" /usr/local/bin
8 changes: 5 additions & 3 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ impl App {
{}
The combined file be created at: {}/{}
The combined file be created at: {}{}{}
The combined file will be in `{}` format
Flag: `--format`, Options: `yaml`, `json`, `json-array`, `json-k8s`
Expand All @@ -100,6 +100,7 @@ impl App {
"dry-run".blue(),
files.white().dimmed(),
std::env::current_dir()?.to_string_lossy().green(),
"/".green(),
self.output.green(),
self.format.to_string().green(),
"--write".green(),
Expand All @@ -124,6 +125,7 @@ impl App {

fn write_to_yaml<T: Write>(&self, mut output: T) -> Result<()> {
for yaml_value in self.get_yamls_iter() {
output.write_all(b"---\n")?;
serde_yaml::to_writer(&mut output, &yaml_value)?;
}

Expand Down Expand Up @@ -222,7 +224,7 @@ fn convert_to_yaml(path: &Path) -> Result<Vec<Value>> {
let mut yamls = Vec::new();

match path.extension().and_then(|path| path.to_str()) {
Some("yaml") => {
Some("yaml" | "yml") => {
let mut yaml_string = String::new();
reader.read_to_string(&mut yaml_string)?;

Expand Down Expand Up @@ -261,7 +263,7 @@ fn get_all_files(args: &CliArgs) -> Option<Vec<PathBuf>> {
.filter(|f| {
matches!(
f.path().extension().and_then(|path| path.to_str()),
Some("yaml" | "json" | "yml")
Some("yaml" | "yml" | "json")
)
})
.map(|file| file.path().to_owned())
Expand Down

0 comments on commit 3567854

Please sign in to comment.