diff --git a/crossplane/__main__.py b/crossplane/__main__.py
index c92d7f3..16fe34a 100644
--- a/crossplane/__main__.py
+++ b/crossplane/__main__.py
@@ -5,6 +5,7 @@ import sys
 from argparse import ArgumentParser, FileType, RawDescriptionHelpFormatter
 from traceback import format_exception
 
+from . import __version__
 from .lexer import lex as lex_file
 from .parser import parse as parse_file
 from .errors import NgxParserBaseException
@@ -70,12 +71,14 @@ def _dump_payload(obj, fp, indent):
     fp.write(json.dumps(obj, **kwargs) + '\n')
 
 
-def parse(filename, out, indent=None, catch=None, tb_onerror=None):
+def parse(filename, out, indent=None, catch=None, tb_onerror=None, ignore='', single=False):
+    ignore = ignore.split(',') if ignore else []
+
     def callback(e):
         exc = sys.exc_info() + (10,)
         return ''.join(format_exception(*exc)).rstrip()
 
-    kwargs = {'catch_errors': catch}
+    kwargs = {'catch_errors': catch, 'ignore': ignore, 'single': single}
     if tb_onerror:
         kwargs['onerror'] = callback
 
@@ -157,6 +160,7 @@ def parse_args(args=None):
         description='various operations for nginx config files',
         usage='%(prog)s <command> [options]'
     )
+    parser.add_argument('-V', '--version', action='version', version='%(prog)s ' + __version__)
     subparsers = parser.add_subparsers(title='commands')
 
     def create_subparser(function, help):
@@ -170,8 +174,10 @@ def parse_args(args=None):
     p.add_argument('filename', help='the nginx config file')
     p.add_argument('-o', '--out', type=FileType('w'), default='-', help='write output to a file')
     p.add_argument('-i', '--indent', type=int, metavar='NUM', help='number of spaces to indent output')
+    p.add_argument('--ignore', metavar='DIRECTIVES', default='', help='ignore directives (comma-separated)')
     p.add_argument('--no-catch', action='store_false', dest='catch', help='only collect first error in file')
     p.add_argument('--tb-onerror', action='store_true', help='include tracebacks in config errors')
+    p.add_argument('--single-file', action='store_true', dest='single', help='do not include other config files')
 
     p = create_subparser(lex, 'lexes tokens from an nginx config file')
     p.add_argument('filename', help='the nginx config file')
@@ -201,7 +207,7 @@ def parse_args(args=None):
 
     parsed = parser.parse_args(args=args)
 
-    # this addresses a bug  that was added to argparse in Python 3.3
+    # this addresses a bug that was added to argparse in Python 3.3
     if not parsed.__dict__:
         parser.error('too few arguments')
 
diff --git a/crossplane/parser.py b/crossplane/parser.py
index 8f0e0f0..d91d835 100644
--- a/crossplane/parser.py
+++ b/crossplane/parser.py
@@ -19,8 +19,17 @@ def _prepare_if_args(stmt):
         args[:] = args[start:end]
 
 
-def parse(filename, onerror=None, catch_errors=True):
-    """Parses an nginx config file and returns a nested dict payload"""
+def parse(filename, onerror=None, catch_errors=True, ignore=(), single=False):
+    """
+    Parses an nginx config file and returns a nested dict payload
+    
+    :param filename: string contianing the name of the config file to parse
+    :param onerror: function that determines what's saved in "callback"
+    :param catch_errors: bool; if False, parse stops after first error
+    :param ignore: list or tuple of directives to exclude from the payload
+    :param single: bool; if True, including from other files doesn't happen
+    :returns: a payload that describes the parsed nginx config
+    """
     config_dir = os.path.dirname(filename)
 
     payload = {
@@ -82,6 +91,13 @@ def parse(filename, onerror=None, catch_errors=True):
                 stmt['args'].append(token)
                 token, __ = next(tokens)
 
+            # consume the directive if it is ignored and move on
+            if stmt['directive'] in ignore:
+                # if this directive was a block consume it too
+                if token == '{':
+                    _parse(parsing, tokens, consume=True)
+                continue
+
             # prepare arguments
             if stmt['directive'] == 'if':
                 _prepare_if_args(stmt)
@@ -103,7 +119,7 @@ def parse(filename, onerror=None, catch_errors=True):
                     raise e
 
             # add "includes" to the payload if this is an include statement
-            if stmt['directive'] == 'include':
+            if not single and stmt['directive'] == 'include':
                 pattern = args[0]
                 if not os.path.isabs(args[0]):
                     pattern = os.path.join(config_dir, args[0])

Option to ignore includes
This is a nice to have option at least in my usecase.   Right now I am 'text' validating the config generated by controller. Instead I plan to run in through crossplane and validate the args and the directives part. Controller has some default 'include' directives but does not generate them. So when I run it through crossplane it complains about those missing includes. 


diff --git a/tests/test_parse.py b/tests/test_parse.py
index da5fe2b..c407ee9 100644
--- a/tests/test_parse.py
+++ b/tests/test_parse.py
@@ -247,3 +247,123 @@ def test_includes_globbed():
             }
         ]
     }
+
+
+def test_includes_single():
+    dirname = os.path.join(here, 'configs', 'includes-regular')
+    config = os.path.join(dirname, 'nginx.conf')
+    payload = crossplane.parse(config, single=True)
+    assert payload == {
+        'status': 'ok',
+        'errors': [],
+        'config': [
+            {
+                'file': os.path.join(dirname, 'nginx.conf'),
+                'status': 'ok',
+                'errors': [],
+                'parsed': [
+                    {
+                        'directive': 'events',
+                        'line': 1,
+                        'args': [],
+                        'block': []
+                    },
+                    {
+                        'directive': 'http',
+                        'line': 2,
+                        'args': [],
+                        'block': [
+                            {
+                                'directive': 'include',
+                                'line': 3,
+                                'args': ['conf.d/server.conf']
+                                # no 'includes' key
+                            }
+                        ]
+                    }
+                ]
+            }
+            # single config parsed
+        ]
+    }
+
+
+def test_ignore_directives():
+    dirname = os.path.join(here, 'configs', 'simple')
+    config = os.path.join(dirname, 'nginx.conf')
+
+    # check that you can ignore multiple directives
+    payload = crossplane.parse(config, ignore=['listen', 'server_name'])
+    assert payload == {
+        "status": "ok",
+        "errors": [],
+        "config": [
+            {
+                "file": os.path.join(dirname, 'nginx.conf'),
+                "status": "ok",
+                "errors": [],
+                "parsed": [
+                    {
+                        "directive": "events",
+                        "line": 1,
+                        "args": [],
+                        "block": [
+                            {
+                                "directive": "worker_connections",
+                                "line": 2,
+                                "args": ["1024"]
+                            }
+                        ]
+                    },
+                    {
+                        "directive": "http",
+                        "line": 5,
+                        "args": [],
+                        "block": [
+                            {
+                                "directive": "server",
+                                "line": 6,
+                                "args": [],
+                                "block": [
+                                    {
+                                        "directive": "location",
+                                        "line": 9,
+                                        "args": ["/"],
+                                        "block": [
+                                            {
+                                                "directive": "return",
+                                                "line": 10,
+                                                "args": ["200", "foo bar baz"]
+                                            }
+                                        ]
+                                    }
+                                ]
+                            }
+                        ]
+                    }
+                ]
+            }
+        ]
+    }
+
+    # check that you can also ignore block directives
+    payload = crossplane.parse(config, ignore=['events', 'server'])
+    assert payload == {
+        "status": "ok",
+        "errors": [],
+        "config": [
+            {
+                "file": os.path.join(dirname, 'nginx.conf'),
+                "status": "ok",
+                "errors": [],
+                "parsed": [
+                    {
+                        "directive": "http",
+                        "line": 5,
+                        "args": [],
+                        "block": []
+                    }
+                ]
+            }
+        ]
+    }

pip install -e .
parse_log_pytest
pytest
pytest
3.6
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
-e git+https://github.com/nginxinc/crossplane.git@641124a79676e71b979950b88d2109daf2a67881#egg=crossplane
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work

name: crossplane
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - attrs=21.4.0=pyhd3eb1b0_0
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - importlib-metadata=4.8.1=py36h06a4308_0
  - importlib_metadata=4.8.1=hd3eb1b0_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - more-itertools=8.12.0=pyhd3eb1b0_0
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - packaging=21.3=pyhd3eb1b0_0
  - pip=21.2.2=py36h06a4308_0
  - pluggy=0.13.1=py36h06a4308_0
  - py=1.11.0=pyhd3eb1b0_0
  - pyparsing=3.0.4=pyhd3eb1b0_0
  - pytest=6.2.4=py36h06a4308_2
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - toml=0.10.2=pyhd3eb1b0_0
  - typing_extensions=4.1.1=pyh06a4308_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zipp=3.6.0=pyhd3eb1b0_0
  - zlib=1.2.13=h5eee18b_1
prefix: /opt/conda/envs/crossplane

tests/test_parse.py::test_includes_single tests/test_parse.py::test_ignore_directives
tests/test_parse.py::test_includes_globbed
tests/test_parse.py::test_includes_regular
crossplane/__main__.py crossplane/parser.py
crossplane/__main__.py crossplane/parser.py