From 9852fc155b286536ed9990f04879985e8d774e1e Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 6 Jul 2026 08:26:22 +0200 Subject: [PATCH 1/3] Standardize README landing page --- README.md | 45 ++++++++------------------------------------- 1 file changed, 8 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index 0908883..afeb254 100644 --- a/README.md +++ b/README.md @@ -1,56 +1,27 @@ # Ast -A PowerShell module for using the Abstract Syntax Tree (AST) on any PowerShell code. - -## Prerequisites - -This uses the following external resources: -- The [PSModule framework](https://github.com/PSModule) for building, testing and publishing the module. +Ast is a PowerShell module for using the PowerShell abstract syntax tree to analyze PowerShell code. ## Installation -To install the module from the PowerShell Gallery, you can use the following command: +Install the module from the PowerShell Gallery: ```powershell Install-PSResource -Name Ast Import-Module -Name Ast ``` -## Usage - -Here is a list of example that are typical use cases for the module. +## Documentation -### Example 1: Get the function name from a script +Documentation is published at [psmodule.io/Ast](https://psmodule.io/Ast/). -This example shows how to get the function name from a script. +Use PowerShell help and command discovery for module details: ```powershell -Get-AstFunctionName -Path 'Test-Me.ps1' -Test-Me +Get-Command -Module Ast +Get-Help -Examples ``` -### Find more examples - -To find more examples of how to use the module, please refer to the [examples](examples) folder. - -Alternatively, you can use the Get-Command -Module 'This module' to find more commands that are available in the module. -To find examples of each of the commands you can use Get-Help -Examples 'CommandName'. - ## Contributing -Coder or not, you can contribute to the project! We welcome all contributions. - -### For Users - -If you don't code, you still sit on valuable information that can make this project even better. If you experience that the -product does unexpected things, throw errors or is missing functionality, you can help by submitting bugs and feature requests. -Please see the issues tab on this project and submit a new issue that matches your needs. - -### For Developers - -If you do code, we'd love to have your contributions. Please read the [Contribution guidelines](CONTRIBUTING.md) for more information. -You can either help by picking up an existing issue or submit a new one if you have an idea for a new feature or improvement. - -## Tools - -- [lzybkr/ShowPSAst](https://github.com/lzybkr/ShowPSAst) +Issues and pull requests are welcome. Please use the repository issue tracker to report bugs, request features, or discuss improvements. From 925e796306b8d853254969909faa25b9f3b148dd Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 12 Jul 2026 11:18:55 +0200 Subject: [PATCH 2/3] Restore usage examples, fix help discovery command, drop Contributing --- README.md | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index afeb254..6802357 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # Ast -Ast is a PowerShell module for using the PowerShell abstract syntax tree to analyze PowerShell code. +Ast is a PowerShell module for using the PowerShell abstract syntax tree (AST) to analyze PowerShell code. It provides +commands to extract functions, commands, aliases, comments, and script structure from a file, a string of script content, +or an existing AST object. ## Installation @@ -11,6 +13,31 @@ Install-PSResource -Name Ast Import-Module -Name Ast ``` +## Usage + +The commands accept a file path (`-Path`), inline script content (`-Script`), or an existing AST object (`-Ast`), and +default to matching everything so you can narrow the results with `-Name`. + +### Example: List the functions defined in a script + +```powershell +Get-AstFunction -Path ./MyScript.ps1 +Get-AstFunctionName -Path ./MyScript.ps1 +``` + +### Example: Find the commands invoked by a script + +```powershell +Get-AstCommand -Path ./MyScript.ps1 +Get-AstCommand -Script "Get-Process; Write-Host 'Hello'" +``` + +### Example: Inspect a single function by name + +```powershell +Get-AstFunction -Path ./MyScript.ps1 -Name 'Test-Me' +``` + ## Documentation Documentation is published at [psmodule.io/Ast](https://psmodule.io/Ast/). @@ -19,9 +46,9 @@ Use PowerShell help and command discovery for module details: ```powershell Get-Command -Module Ast -Get-Help -Examples +Get-Help -Name Get-AstFunction -Examples ``` -## Contributing +## Related tools -Issues and pull requests are welcome. Please use the repository issue tracker to report bugs, request features, or discuss improvements. +- [lzybkr/ShowPSAst](https://github.com/lzybkr/ShowPSAst) — an interactive viewer for exploring the PowerShell AST. From 3e8807b803f6f9a339b2374ef9d6846da335dc51 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 12 Jul 2026 11:24:41 +0200 Subject: [PATCH 3/3] Drop -Ast from Usage intro (not exposed by Get-AstFunctionName) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6802357..4a9763e 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,8 @@ Import-Module -Name Ast ## Usage -The commands accept a file path (`-Path`), inline script content (`-Script`), or an existing AST object (`-Ast`), and -default to matching everything so you can narrow the results with `-Name`. +The commands accept a file path (`-Path`) or inline script content (`-Script`), and default to matching everything so +you can narrow the results with `-Name`. ### Example: List the functions defined in a script