Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow reading CRDs from yaml file #46

Merged
merged 2 commits into from
Apr 17, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fmt
Signed-off-by: clux <sszynrae@gmail.com>
  • Loading branch information
clux committed Apr 17, 2022
commit 2bd87743c64dc417bf3c18e3ef6920508c8c0979
7 changes: 3 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,8 @@ impl Kopium {
self.generate(crd).await
} else if let Some(f) = self.file.as_deref() {
// no cluster access needed in this case
let data = std::fs::read_to_string(&f).with_context(|| {
format!("Failed to read {}", f.display())
})?;
let data =
std::fs::read_to_string(&f).with_context(|| format!("Failed to read {}", f.display()))?;
let crd: CustomResourceDefinition = serde_yaml::from_str(&data)?;
self.generate(crd).await
} else {
Expand All @@ -145,7 +144,7 @@ impl Kopium {
.await
.map(Api::<CustomResourceDefinition>::all)?;
self.list_crds(api).await
},
}
Some(Command::Completions { shell }) => self.completions(shell),
None => self.help(),
}
Expand Down