4

What is the correct syntax for the CLI to exclude multiple folders in ApiGen?

I tried separating them with comma, but that's ignored (probably read as one path):

H:\SERVER>php apigen.phar generate --source [PATH] --destination [PATH] --exclude [PATH]*,[PATH]*

4 Answers4

1

Using the terminal, I suppose you could do:

php apigen.phar generate --source xxx --destination xxx --exclude folder_to_excluse --exlude yet_another_folder

(its the same behavior with multiple sources)

I'm trying to exclude multiple folders in a .conf file, when I have the answer I'll update this answer :D, hope it helps.

-- Update --

To add multiple sources and/or multiple exclude references from a config file:

# Source file or directory to parse
source:
    # ../PASTA
    - ../sys
    - ../anotherfolder
# Directory where to save the generated documentation
destination: 'C:\xampp\htdocs\yourfolder'
# List of allowed file extensions
extensions: [php]
# Mask to exclude file or directory from processing
exclude: 
    - '../sys/vendor'
    - '..sys/core'
#next elements of the config file.

And to run the config file:

 apigen generate --config file.conf
André Tzermias
  • 1,172
  • 10
  • 13
  • Thanks, but it still doesn't exclude the folders, even with the config file. I have tried it like this: `- '[path]/php/Vendors*'` and without the `*` at the end - all the classes within Vendors still appear in the documentation – Anastasia Sitnina Oct 12 '15 at 13:58
  • You shouldn't use commas nor ' or " in the command line. what is the folder structure, and where is the config file? – André Tzermias Oct 13 '15 at 15:14
  • No commas or `or` at the moment: `exclude: - 'htdocs/cwd-fw/src/php/Vendors*' - 'htdocs/cwd-fw/src/php/Entities*'` Maybe I should remove the quotes? – Anastasia Sitnina Oct 13 '15 at 17:44
  • I can't tell! I noticed that from the config file I should use the ' ', but from command line I shouldn't use any '. – André Tzermias Oct 14 '15 at 00:37
  • Unfortunately with or without single quotes - it just ignores the settings and all folders are added – Anastasia Sitnina Nov 01 '15 at 23:36
  • Dear Anastasia, have ou checked if the config file does anything at all? For example, if you only switch the destination folder, or the title of the doc... does it seems to have effect? How are you calling the apigen with the config file? – André Tzermias Nov 05 '15 at 14:39
  • Probably needs to re-answer for new release. It does not seem to accept `--config`. – Bimal Poudel Dec 20 '17 at 10:45
0

Use the next syntax, for example to skip the directories (Vendor, Config and X)

For windows:

php apigen.phar generate --source [YOUR-SOURCE-PATH] --destination [DESTINATION-PATH] --skip-doc-path "*/Vendor*" --skip-doc-path "*/Config*" --skip-doc-path "*/Docs/X*"

Linux:

apigen generate -s [YOUR-SOURCE-PATH] -d [DESTINATION-PATH] --skip-doc-path "*/Vendor*" --skip-doc-path "*/Config*" --skip-doc-path "*/Docs/X*"

Phani
  • 5,319
  • 6
  • 35
  • 43
0

The correct way to exclude folders from APIGEN documentation is to specify the following option:

--exclude /path/to/folder

NOTE that there is no trailing slash and no wildcard beyond the name of the folder. If you specify --exclude /path/to/folder/ it will not work and if you do --exclude /path/to/folder/* it will only exclude the first file in the specified folder.

JG Estiot
  • 969
  • 1
  • 10
  • 8
0

Use your paths relative to --source. For example if your sources are located at /Users/abc/www and you want to exclude /Users/abc/www/a and /Users/abc/www/b folders and let's say /Users/abc/www/tests/test.php file, use the command like below:

php apigen.phar generate --source /Users/abc/www --destination /Users/abc/docs --exclude a,b,tests/test.php

no trailing slash or wildcard. seperate them with commas. worked for me.