Skip to content

Commit

Permalink
chore: cleaning code
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudLigny committed Jan 24, 2025
1 parent ca23f69 commit 5692bc6
Show file tree
Hide file tree
Showing 14 changed files with 70 additions and 96 deletions.
26 changes: 12 additions & 14 deletions src/Command/Build.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,18 @@ protected function configure()
$this
->setName('build')
->setDescription('Builds the website')
->setDefinition(
new InputDefinition([
new InputArgument('path', InputArgument::OPTIONAL, 'Use the given path as working directory'),
new InputOption('config', 'c', InputOption::VALUE_REQUIRED, 'Set the path to extra config files (comma-separated)'),
new InputOption('drafts', 'd', InputOption::VALUE_NONE, 'Include drafts'),
new InputOption('page', 'p', InputOption::VALUE_REQUIRED, 'Build a specific page'),
new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Build without saving'),
new InputOption('baseurl', null, InputOption::VALUE_REQUIRED, 'Set the base URL'),
new InputOption('output', null, InputOption::VALUE_REQUIRED, 'Set the output directory'),
new InputOption('optimize', null, InputOption::VALUE_OPTIONAL, 'Optimize files (disable with "no")', false),
new InputOption('clear-cache', null, InputOption::VALUE_OPTIONAL, 'Clear cache before build (optional cache key regular expression)', false),
new InputOption('show-pages', null, InputOption::VALUE_NONE, 'Show built pages as table'),
])
)
->setDefinition([
new InputArgument('path', InputArgument::OPTIONAL, 'Use the given path as working directory'),
new InputOption('config', 'c', InputOption::VALUE_REQUIRED, 'Set the path to extra config files (comma-separated)'),
new InputOption('drafts', 'd', InputOption::VALUE_NONE, 'Include drafts'),
new InputOption('page', 'p', InputOption::VALUE_REQUIRED, 'Build a specific page'),
new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Build without saving'),
new InputOption('baseurl', null, InputOption::VALUE_REQUIRED, 'Set the base URL'),
new InputOption('output', null, InputOption::VALUE_REQUIRED, 'Set the output directory'),
new InputOption('optimize', null, InputOption::VALUE_OPTIONAL, 'Optimize files (disable with "no")', false),
new InputOption('clear-cache', null, InputOption::VALUE_OPTIONAL, 'Clear cache before build (optional cache key regular expression)', false),
new InputOption('show-pages', null, InputOption::VALUE_NONE, 'Show built pages as table'),
])
->setHelp('Builds the website in the output directory');
}

Expand Down
8 changes: 3 additions & 5 deletions src/Command/CacheClear.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@ protected function configure()
$this
->setName('cache:clear')
->setDescription('Removes all caches')
->setDefinition(
new InputDefinition([
new InputArgument('path', InputArgument::OPTIONAL, 'Use the given path as working directory'),
])
)
->setDefinition([
new InputArgument('path', InputArgument::OPTIONAL, 'Use the given path as working directory'),
])
->setHelp('Removes all cached files');
}

Expand Down
8 changes: 3 additions & 5 deletions src/Command/CacheClearAssets.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@ protected function configure()
$this
->setName('cache:clear:assets')
->setDescription('Removes assets cache')
->setDefinition(
new InputDefinition([
new InputArgument('path', InputArgument::OPTIONAL, 'Use the given path as working directory'),
])
)
->setDefinition([
new InputArgument('path', InputArgument::OPTIONAL, 'Use the given path as working directory'),
])
->setHelp('Removes cached assets files');
}

Expand Down
8 changes: 3 additions & 5 deletions src/Command/CacheClearTemplates.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@ protected function configure()
$this
->setName('cache:clear:templates')
->setDescription('Removes templates cache')
->setDefinition(
new InputDefinition([
new InputArgument('path', InputArgument::OPTIONAL, 'Use the given path as working directory'),
])
)
->setDefinition([
new InputArgument('path', InputArgument::OPTIONAL, 'Use the given path as working directory'),
])
->setHelp('Removes cached templates files');
}

Expand Down
8 changes: 3 additions & 5 deletions src/Command/CacheClearTranslations.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@ protected function configure()
$this
->setName('cache:clear:translations')
->setDescription('Removes translations cache')
->setDefinition(
new InputDefinition([
new InputArgument('path', InputArgument::OPTIONAL, 'Use the given path as working directory'),
])
)
->setDefinition([
new InputArgument('path', InputArgument::OPTIONAL, 'Use the given path as working directory'),
])
->setHelp('Removes cached translations files');
}

Expand Down
8 changes: 3 additions & 5 deletions src/Command/Clear.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@ protected function configure()
$this
->setName('clear')
->setDescription('Removes generated files')
->setDefinition(
new InputDefinition([
new InputArgument('path', InputArgument::OPTIONAL, 'Use the given path as working directory'),
])
)
->setDefinition([
new InputArgument('path', InputArgument::OPTIONAL, 'Use the given path as working directory'),
])
->setHelp('Removes generated, temporary and cache files');
}

Expand Down
18 changes: 8 additions & 10 deletions src/Command/NewPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,14 @@ protected function configure()
$this
->setName('new:page')
->setDescription('Creates a new page')
->setDefinition(
new InputDefinition([
new InputArgument('path', InputArgument::OPTIONAL, 'Use the given path as working directory'),
new InputOption('name', null, InputOption::VALUE_REQUIRED, 'Page path name'),
new InputOption('prefix', 'p', InputOption::VALUE_NONE, 'Prefix the file name with the current date (`YYYY-MM-DD`)'),
new InputOption('force', 'f', InputOption::VALUE_NONE, 'Override the file if already exist'),
new InputOption('open', 'o', InputOption::VALUE_NONE, 'Open editor automatically'),
new InputOption('editor', null, InputOption::VALUE_REQUIRED, 'Editor to use with open option'),
])
)
->setDefinition([
new InputArgument('path', InputArgument::OPTIONAL, 'Use the given path as working directory'),
new InputOption('name', null, InputOption::VALUE_REQUIRED, 'Page path name'),
new InputOption('prefix', 'p', InputOption::VALUE_NONE, 'Prefix the file name with the current date (`YYYY-MM-DD`)'),
new InputOption('force', 'f', InputOption::VALUE_NONE, 'Override the file if already exist'),
new InputOption('open', 'o', InputOption::VALUE_NONE, 'Open editor automatically'),
new InputOption('editor', null, InputOption::VALUE_REQUIRED, 'Editor to use with open option'),
])
->setHelp('Creates a new page file (with filename as title)');
}

Expand Down
12 changes: 5 additions & 7 deletions src/Command/NewSite.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,11 @@ protected function configure()
$this
->setName('new:site')
->setDescription('Creates a new website')
->setDefinition(
new InputDefinition([
new InputArgument('path', InputArgument::OPTIONAL, 'Use the given path as working directory'),
new InputOption('force', 'f', InputOption::VALUE_NONE, 'Override directory if it already exists'),
new InputOption('demo', null, InputOption::VALUE_NONE, 'Add demo content (pages, templates and assets)'),
])
)
->setDefinition([
new InputArgument('path', InputArgument::OPTIONAL, 'Use the given path as working directory'),
new InputOption('force', 'f', InputOption::VALUE_NONE, 'Override directory if it already exists'),
new InputOption('demo', null, InputOption::VALUE_NONE, 'Add demo content (pages, templates and assets)'),
])
->setHelp('Creates a new website in the current directory, or in <path> if provided');
}

Expand Down
10 changes: 4 additions & 6 deletions src/Command/OpenWith.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,10 @@ protected function configure()
$this
->setName('open')
->setDescription('Open pages directory with the editor')
->setDefinition(
new InputDefinition([
new InputArgument('path', InputArgument::OPTIONAL, 'Use the given path as working directory'),
new InputOption('editor', null, InputOption::VALUE_REQUIRED, 'Editor to use'),
])
)
->setDefinition([
new InputArgument('path', InputArgument::OPTIONAL, 'Use the given path as working directory'),
new InputOption('editor', null, InputOption::VALUE_REQUIRED, 'Editor to use'),
])
->setHelp('Open pages directory with the editor defined in the configuration file.');
}

Expand Down
4 changes: 2 additions & 2 deletions src/Command/SelfUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ protected function configure()
$this
->setName('self-update')
->setDescription('Updates Cecil to the latest version')
->setDefinition(new InputDefinition([
->setDefinition([
new InputOption('rollback', null, InputOption::VALUE_NONE, 'Revert to an older installation'),
new InputOption('stable', null, InputOption::VALUE_NONE, 'Force an update to the last stable version'),
new InputOption('preview', null, InputOption::VALUE_NONE, 'Force an update to the last unstable version'),
]))
])
->setHelp('The self-update command checks for a newer version and, if found, downloads and installs the latest');
}

Expand Down
26 changes: 12 additions & 14 deletions src/Command/Serve.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,18 @@ protected function configure()
$this
->setName('serve')
->setDescription('Starts the built-in server')
->setDefinition(
new InputDefinition([
new InputArgument('path', InputArgument::OPTIONAL, 'Use the given path as working directory'),
new InputOption('config', 'c', InputOption::VALUE_REQUIRED, 'Set the path to extra config files (comma-separated)'),
new InputOption('drafts', 'd', InputOption::VALUE_NONE, 'Include drafts'),
new InputOption('page', 'p', InputOption::VALUE_REQUIRED, 'Build a specific page'),
new InputOption('open', 'o', InputOption::VALUE_NONE, 'Open web browser automatically'),
new InputOption('host', null, InputOption::VALUE_REQUIRED, 'Server host'),
new InputOption('port', null, InputOption::VALUE_REQUIRED, 'Server port'),
new InputOption('optimize', null, InputOption::VALUE_OPTIONAL, 'Optimize files (disable with "no")', false),
new InputOption('clear-cache', null, InputOption::VALUE_OPTIONAL, 'Clear cache before build (optional cache key regular expression)', false),
new InputOption('no-ignore-vcs', null, InputOption::VALUE_NONE, 'Changes watcher must not ignore VCS directories'),
])
)
->setDefinition([
new InputArgument('path', InputArgument::OPTIONAL, 'Use the given path as working directory'),
new InputOption('config', 'c', InputOption::VALUE_REQUIRED, 'Set the path to extra config files (comma-separated)'),
new InputOption('drafts', 'd', InputOption::VALUE_NONE, 'Include drafts'),
new InputOption('page', 'p', InputOption::VALUE_REQUIRED, 'Build a specific page'),
new InputOption('open', 'o', InputOption::VALUE_NONE, 'Open web browser automatically'),
new InputOption('host', null, InputOption::VALUE_REQUIRED, 'Server host'),
new InputOption('port', null, InputOption::VALUE_REQUIRED, 'Server port'),
new InputOption('optimize', null, InputOption::VALUE_OPTIONAL, 'Optimize files (disable with "no")', false),
new InputOption('clear-cache', null, InputOption::VALUE_OPTIONAL, 'Clear cache before build (optional cache key regular expression)', false),
new InputOption('no-ignore-vcs', null, InputOption::VALUE_NONE, 'Changes watcher must not ignore VCS directories'),
])
->setHelp('Starts the live-reloading-built-in web server');
}

Expand Down
10 changes: 4 additions & 6 deletions src/Command/ShowConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,10 @@ protected function configure()
$this
->setName('show:config')
->setDescription('Shows the configuration')
->setDefinition(
new InputDefinition([
new InputArgument('path', InputArgument::OPTIONAL, 'Use the given path as working directory'),
new InputOption('config', 'c', InputOption::VALUE_REQUIRED, 'Set the path to the config file'),
])
)
->setDefinition([
new InputArgument('path', InputArgument::OPTIONAL, 'Use the given path as working directory'),
new InputOption('config', 'c', InputOption::VALUE_REQUIRED, 'Set the path to the config file'),
])
->setHelp('Shows the website\'s configuration in YAML format');
}

Expand Down
10 changes: 4 additions & 6 deletions src/Command/ShowContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,10 @@ protected function configure()
$this
->setName('show:content')
->setDescription('Shows content as tree')
->setDefinition(
new InputDefinition([
new InputArgument('path', InputArgument::OPTIONAL, 'Use the given path as working directory'),
new InputOption('config', 'c', InputOption::VALUE_REQUIRED, 'Set the path to the config file'),
])
)
->setDefinition([
new InputArgument('path', InputArgument::OPTIONAL, 'Use the given path as working directory'),
new InputOption('config', 'c', InputOption::VALUE_REQUIRED, 'Set the path to the config file'),
])
->setHelp('Shows the website\'s content as a tree');
}

Expand Down
10 changes: 4 additions & 6 deletions src/Command/UtilTemplatesExtract.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,10 @@ protected function configure()
$this
->setName('util:templates:extract')
->setDescription('Extracts built-in templates')
->setDefinition(
new InputDefinition([
new InputArgument('path', InputArgument::OPTIONAL, 'Use the given path as working directory'),
new InputOption('force', 'f', InputOption::VALUE_NONE, 'Override files if they already exist'),
])
)
->setDefinition([
new InputArgument('path', InputArgument::OPTIONAL, 'Use the given path as working directory'),
new InputOption('force', 'f', InputOption::VALUE_NONE, 'Override files if they already exist'),
])
->setHelp('Extracts built-in templates in the "layouts" directory.');
}

Expand Down

0 comments on commit 5692bc6

Please sign in to comment.