Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion docs/command-line-slangc-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ slangc -help-style markdown -h
* [vulkan-shift](#vulkan-shift)
* [capability](#capability)
* [file-extension](#file-extension)
* [help-category](#help-category)

<a id="General"></a>
## General
Expand Down Expand Up @@ -94,7 +95,7 @@ Emit IR typically as a '.slang-module' when outputting to a container.
<a id="h"></a>
### -h, -help, --help

**-h or -h &lt;help-category&gt;**
**-h or -h &lt;[help-category](#help-category)&gt;**

Print this message, or help in specified category.

Expand Down Expand Up @@ -1599,3 +1600,36 @@ A [&lt;language&gt;](#language), &lt;format&gt;, and/or [&lt;stage&gt;](#stage)
* `slang-module`, `slang-library` : Slang Module/Library
* `dir` : Container as a directory

<a id="help-category"></a>
## help-category

Available help categories for the [-h](#h) option

* `General` : General options
* `Target` : Target code generation options
* `Downstream` : Downstream compiler options
* `Debugging` : Compiler debugging/instrumentation options
* `Repro` : Slang repro system related
* `Experimental` : Experimental options (use at your own risk)
* `Internal` : Internal-use options (use at your own risk)
* `Deprecated` : Deprecated options (allowed but ignored; may be removed in future)
* `compiler` : Downstream Compilers (aka Pass through)
* `language` : Language
* `language-version` : Language Version
* `archive-type` : Archive Type
* `line-directive-mode` : Line Directive Mode
* `debug-info-format` : Debug Info Format
* `fp-mode` : Floating Point Mode
* `fp-denormal-mode` : Floating Point Denormal Handling Mode
* `help-style` : Help Style
* `optimization-level` : Optimization Level
* `debug-level` : Debug Level
* `file-system-type` : File System Type
* `source-embed-style` : Source Embed Style
* `target` : Target
* `stage` : Stage
* `vulkan-shift` : Vulkan Shift
* `capability` : A capability describes an optional feature that a target may or may not support. When a [-capability](#capability-1) is specified, the compiler may assume that the target supports that capability, and generate code accordingly.
* `file-extension` : A [&lt;language&gt;](#language), &lt;format&gt;, and/or [&lt;stage&gt;](#stage) may be inferred from the extension of an input or [-o](#o) path
* `help-category` : Available help categories for the [-h](#h) option

7 changes: 7 additions & 0 deletions source/core/slang-command-options-writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,13 @@ void TextCommandOptionsWriter::appendDescriptionImpl()
{
_appendDescriptionForCategory(categoryIndex);
}

// Add instructions for getting help for specific categories
m_builder << "Getting Help for Specific Categories\n";
m_builder << "=====================================\n\n";
m_builder << "To get help for a specific category of options or values, use: slangc -h "
"<help-category>\n";
m_builder << "See the <help-category> section above for the list of categories.\n\n";
}

void TextCommandOptionsWriter::_appendDescriptionForCategory(Index categoryIndex)
Expand Down
18 changes: 18 additions & 0 deletions source/slang/slang-options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,24 @@ void initCommandOptions(CommandOptions& options)
options.addValues(pairs, SLANG_COUNT_OF(pairs));
}

/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! help-category !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */

{
options.addCategory(
CategoryKind::Value,
"help-category",
"Available help categories for the -h option");

// Add all existing categories as valid help category values
const auto& categories = options.getCategories();
for (Index categoryIndex = 0; categoryIndex < categories.getCount(); ++categoryIndex)
{
const auto& category = categories[categoryIndex];
options.addValue(category.name, category.description);
}
}


/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! General !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */

options.setCategory("General");
Expand Down