Skip to content

Commit

Permalink
Added default command for cli
Browse files Browse the repository at this point in the history
  • Loading branch information
Denisoed committed Mar 31, 2024
1 parent 3253ac7 commit b5a90dd
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 27 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ seo-analyzer -h
| Option | Args | Description |
| --- | --- | --- |
| -h, --help | null | Show all options. |
| -v, --version | null | Show version. |
| -u, --urls | [array] | Multiple url analysis. |
| -f, --files | [array] | Multiple file analysis. |
| -fl, --folder | [array] | Multiple folder analysis. |
| -iu, --ignoreUrls | [array] | Urls to ignore. |
| -if, --ignoreFiles | [array] | Files to ignore. |
| -ifl, --ignoreFolders | [array] | Folders to ignore. |
| -r, --rules | [array] | Rules to run. By default run all default rules. |
| -v, --version | null | **Display Application Version:** Displays the current version of the application. |
| -iu, --ignoreUrls | [array] | **Exclude Specific URLs from Analysis:** Excludes certain URLs from analysis to avoid processing unwanted web pages. |
| -if, --ignoreFiles | [array] | **Exclude Specific Files from Analysis:** Allows excluding certain files from analysis, preventing their processing. |
| -ifl, --ignoreFolders | [array] | **Exclude Specific Folders from Analysis:** Excludes specified folders from the analysis process, ignoring all files within those folders. |
| -u, --urls | [array] | **Perform SEO Analysis on Specified URLs:** Conducts SEO analysis for specified URLs, checking their compliance with certain SEO criteria. |
| -f, --files | [array] | **Perform SEO Analysis on Specified Files:** Performs SEO analysis on specified files, ensuring their adherence to optimization standards and rules. |
| -fl, --folder | [array] | **Perform SEO Analysis on Specified Folders:** Analyzes all files within specified folders for compliance with SEO rules and recommendations. |
| -r, --rules | [array] | **Apply Specific SEO Rules for Analysis:** Applies specific SEO rules during analysis, allowing the user to customize the inspection process. By default run all default rules. |

#### Example of using multiple url analysis

Expand Down
16 changes: 8 additions & 8 deletions README_RU.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ seo-analyzer -h
| Option | Args | Description |
| --- | --- | --- |
| -h, --help | null | Показать справку. |
| -v, --version | null | Показать версию. |
| -u, --urls | [array] | Список url для анализа. |
| -f, --files | [array] | Список html файлов для анализа. |
| -fl, --folder | [array] | Список папок для анализа. |
| -iu, --ignoreUrls | [array] | Игнорируемые url. |
| -if, --ignoreFiles | [array] | Игнорируемые html файлы. |
| -ifl, --ignoreFolders | [array] | Игнорируемые папки. |
| -r, --rules | [array] | Список правил для анализа. Поумолчанию запускаются все дефолтные правила. |
| -v, --version | null | **Display Application Version:** Выводит информацию о текущей версии программы. |
| -iu, --ignoreUrls | [array] | **Exclude Specific URLs from Analysis:** Исключает определенные URL из анализа для предотвращения обработки нежелательных веб-страниц. |
| -if, --ignoreFiles | [array] | **Exclude Specific Files from Analysis:** Позволяет исключить из анализа определенные файлы, предотвращая их обработку. |
| -ifl, --ignoreFolders | [array] | **Exclude Specific Folders from Analysis:** Исключает указанные папки из процесса анализа, игнорируя все файлы внутри этих папок. |
| -u, --urls | [array] | **Perform SEO Analysis on Specified URLs:** Выполняет SEO-анализ для указанных URL-адресов, проверяя их на соответствие определенным SEO-критериям. |
| -f, --files | [array] | **Perform SEO Analysis on Specified Files:** Производит анализ SEO для указанных файлов, обеспечивая их соответствие стандартам и правилам оптимизации. |
| -fl, --folder | [array] | **Perform SEO Analysis on Specified Folders:** Анализирует все файлы в указанных папках на предмет соответствия SEO-правилам и рекомендациям. |
| -r, --rules | [array] | **Apply Specific SEO Rules for Analysis:** Применяет определенные правила SEO при анализе, позволяя пользователю кастомизировать процесс проверки. Поумолчанию запускаются все дефолтные правила. |

#### Пример использования с множеством url

Expand Down
45 changes: 35 additions & 10 deletions bin/index.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,54 @@
#!/usr/bin/env node
const { Command } = require('commander');
const ver = require('./version');
const version = require('./version');
const analyzer = require('./analyzer');

const program = new Command();

program
.option('-v, --version', 'Show version', ver, '')
.option(
'-v, --version',
'Display Application Version: Displays the current version of the application.'
)
// IGNORES
.option('-iu, --ignore-urls <ignoreUrls...>', 'Multiple ignore urls')
.option('-if, --ignore-files <ignoreFiles...>', 'Multiple ignore files')
.option(
'-iu, --ignore-urls <ignoreUrls...>',
'Exclude Specific URLs from Analysis: Excludes certain URLs from analysis to avoid processing unwanted web pages.'
)
.option(
'-if, --ignore-files <ignoreFiles...>',
'Exclude Specific Files from Analysis: Allows excluding certain files from analysis, preventing their processing.'
)
.option(
'-ifl, --ignore-folders <ignoreFolders...>',
'Multiple ignore folders'
'Exclude Specific Folders from Analysis: Excludes specified folders from the analysis process, ignoring all files within those folders.'
)
// INPUTS
.option('-u, --urls <urls...>', 'Multiple url analysis')
.option('-f, --files <files...>', 'Multiple files analysis')
.option('-fl, --folders <folders...>', 'Multiple folders analysis')
.option(
'-u, --urls <urls...>',
'Perform SEO Analysis on Specified URLs: Conducts SEO analysis for specified URLs, checking their compliance with certain SEO criteria.'
)
.option(
'-f, --files <files...>',
'Perform SEO Analysis on Specified Files: Performs SEO analysis on specified files, ensuring their adherence to optimization standards and rules.'
)
.option(
'-fl, --folders <folders...>',
'Perform SEO Analysis on Specified Folders: Analyzes all files within specified folders for compliance with SEO rules and recommendations.'
)
// RULES
.option('-r, --rules <rules...>', 'Multiple rules')
.option(
'-r, --rules <rules...>',
'Apply Specific SEO Rules for Analysis: Applies specific SEO rules during analysis, allowing the user to customize the inspection process.'
)
.parse(process.argv);

const options = program.opts();

if (!options.version) {
if (!Object.keys(options).length) {
program.outputHelp();
} else if (options.version) {
version();
} else {
analyzer(options);
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "seo-analyzer",
"version": "3.1.0",
"version": "3.1.1",
"description": "A library for analyze a HTML files to show all of the SEO defects",
"main": "dist/seo-analyzer.js",
"types": "dist/seo-analyzer.d.ts",
Expand Down

0 comments on commit b5a90dd

Please sign in to comment.