From 3b24c5d9f46b2c79020931e44590452d4b7f11c4 Mon Sep 17 00:00:00 2001 From: magdev Date: Sat, 1 Jun 2019 12:29:00 +0200 Subject: [PATCH] Use git branch-name as document-name, use default if no git --- app/conf/dossier.yaml | 1 + src/Command/Dossier/DossierBuildCommand.php | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/conf/dossier.yaml b/app/conf/dossier.yaml index 21a7868..f01bf21 100644 --- a/app/conf/dossier.yaml +++ b/app/conf/dossier.yaml @@ -1,5 +1,6 @@ ### Settings file for magdev/dossier charset: utf-8 +docname: dossier # Date formats date: diff --git a/src/Command/Dossier/DossierBuildCommand.php b/src/Command/Dossier/DossierBuildCommand.php index b885400..d860be8 100644 --- a/src/Command/Dossier/DossierBuildCommand.php +++ b/src/Command/Dossier/DossierBuildCommand.php @@ -62,7 +62,7 @@ final class DossierBuildCommand extends BaseCommand ->addOption('locale', 'l', InputOption::VALUE_OPTIONAL, 'Set the locale', 'de') ->addOption('sort', 's', InputOption::VALUE_OPTIONAL, 'Set the sort direction for the CV', CurriculumVitae::SORT_DESC) ->addOption('theme', 't', InputOption::VALUE_OPTIONAL, 'Select the theme', 'print') - ->addOption('docname', 'd', InputOption::VALUE_OPTIONAL, 'Set the name for the output document (w/o extension)', 'dossier') + ->addOption('docname', 'd', InputOption::VALUE_OPTIONAL, 'Set the name for the output document (w/o extension)', '') ->addOption('no-cover', null, InputOption::VALUE_NONE, 'Suppress the cover') ->addOption('no-intro', null, InputOption::VALUE_NONE, 'Suppress the introduction') @@ -97,11 +97,12 @@ final class DossierBuildCommand extends BaseCommand $cssproc = $this->getService('cssproc'); /* @var $cssroc \Magdev\Dossier\Service\StylesheetProcessorService */ + $name = $input->getOption('docname') ?: $this->getService('git')->getCurrentBranchName(); try { $data = new DataCollector(array( 'disabled' => $this->getHelper('section_manager')->getDisabledSections($input), 'theme' => $input->getOption('theme'), - 'name' => $input->getOption('docname'), + 'name' => ($name ?: 'dossier'), 'tags' => $this->config->get('cv.tags'), 'locale' => $this->translator->getTranslator()->getLocale(), 'stylesheet' => $cssproc->parseThemeStyles(),