feat: implement reports
This commit is contained in:
+15
-3
@@ -290,7 +290,11 @@ fn pick_practice_variants(names: &[String]) -> Result<Vec<practice::Variant>> {
|
||||
.collect())
|
||||
}
|
||||
|
||||
/// Resolves the `--variant` flags, defaulting to every document.
|
||||
/// Resolves the `--variant` flags, defaulting to the exam set.
|
||||
///
|
||||
/// The default is [`typst::Variant::EXAM`] rather than every variant: a
|
||||
/// diagnostic is built from responses, not from an assessment record, so
|
||||
/// `export typst` has nothing to build one out of.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
@@ -306,7 +310,7 @@ fn pick_practice_variants(names: &[String]) -> Result<Vec<practice::Variant>> {
|
||||
/// Returns [`Error::Usage`] naming the valid tokens.
|
||||
fn pick_variants(names: &[String]) -> Result<Vec<typst::Variant>> {
|
||||
if names.is_empty() {
|
||||
return Ok(typst::Variant::ALL.to_vec());
|
||||
return Ok(typst::Variant::EXAM.to_vec());
|
||||
}
|
||||
let mut wanted = Vec::new();
|
||||
for name in names {
|
||||
@@ -384,7 +388,15 @@ pub(crate) fn template(cli: &Cli, sub: &TemplateCommand) -> Result<Outcome> {
|
||||
force,
|
||||
stdout,
|
||||
} => {
|
||||
let variants = pick_variants(variant)?;
|
||||
// `export typst` defaults to the exam set, because a report is not
|
||||
// built from an assessment record. Dumping is the opposite case: with
|
||||
// no `--variant` it should hand over every template there is,
|
||||
// including the two reports.
|
||||
let variants = if variant.is_empty() {
|
||||
typst::Variant::ALL.to_vec()
|
||||
} else {
|
||||
pick_variants(variant)?
|
||||
};
|
||||
|
||||
if *stdout {
|
||||
for (index, v) in variants.iter().enumerate() {
|
||||
|
||||
Reference in New Issue
Block a user