Unified · Split
| @@ -1,5 +1,7 @@ | ||
| 1 | 1 | use gix::bstr::{BStr, BString, ByteSlice}; |
| 2 | 2 | |
| 3 | +use crate::OutputFormat; | |
| 4 | + | |
| 3 | 5 | #[derive(Eq, PartialEq, PartialOrd, Ord)] |
| 4 | 6 | enum VersionPart { |
| 5 | 7 | String(BString), |
| @@ -41,7 +43,11 @@ impl Version { · 35 unmodified lines | ||
| 41 | 43 | } |
| 42 | 44 | } |
| 43 | 45 | |
| 44 | −pub fn list(repo: gix::Repository, out: &mut dyn std::io::Write) -> anyhow::Result<()> { | |
| 46 | +pub fn list(repo: gix::Repository, out: &mut dyn std::io::Write, format: OutputFormat) -> anyhow::Result<()> { | |
| 47 | + if format != OutputFormat::Human { | |
| 48 | + anyhow::bail!("JSON output isn't supported"); | |
| 49 | + } | |
| 50 | + | |
| 45 | 51 | let platform = repo.references()?; |
| 46 | 52 | |
| 47 | 53 | let mut tags: Vec<_> = platform |
| @@ -3,7 +3,7 @@ use std::path::Path; · 2 unmodified lines | ||
| 3 | 3 | |
| 4 | 4 | pub use gix_discover::*; |
| 5 | 5 | |
| 6 | −use crate::{bstr::BString, Repository, ThreadSafeRepository}; | |
| 6 | +use crate::{bstr::BString, ThreadSafeRepository}; | |
| 7 | 7 | |
| 8 | 8 | /// The error returned by [`crate::discover()`]. |
| 9 | 9 | #[derive(Debug, thiserror::Error)] |
| @@ -1312,7 +1312,7 @@ pub fn main() -> Result<()> { · 1311 unmodified lines | ||
| 1312 | 1312 | progress, |
| 1313 | 1313 | progress_keep_open, |
| 1314 | 1314 | None, |
| 1315 | − move |_progress, out, _err| core::repository::tag::list(repository(Mode::Lenient)?, out), | |
| 1315 | + move |_progress, out, _err| core::repository::tag::list(repository(Mode::Lenient)?, out, format), | |
| 1316 | 1316 | ), |
| 1317 | 1317 | }, |
| 1318 | 1318 | Subcommands::Tree(cmd) => match cmd { |