Adding total function references to each defined function

Post feature requests, product enhancement ideas, and other product-specific suggestions here. Do not post bug reports.
Forum rules
Do not post any licensing information in this forum.
This topic is 7 years and 9 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
Lembasts
Posts: 405
Last visit: Wed Mar 20, 2024 1:40 pm
Has voted: 1 time
Been upvoted: 1 time

Adding total function references to each defined function

Post by Lembasts »

Greetings,

I run ISESteroids and one thing I find really useful is that above each function definition, it automatically inserts the phrase 'X - references' to show how many times that function has been called. That might be 'relatively' easy to add to PS if you count the calls from within the same file (e.g.psf) only.
However, I have a 'common functions' ps1 file that I call from loads of other psf files. To count the references from all those would be awesome but that would probably require an option to set one or more 'base' folders where function call references would be searched.

Cheers

David
Bosparan
Posts: 290
Last visit: Fri Oct 08, 2021 11:59 am

Re: Adding total function references to each defined function

Post by Bosparan »

Hi David,

Getting a list of references is fairly simple, even over loosely connected files:

Dir -Path "<Script Root>" -Recurse | Select-String "Get-ExampleFunctionName"

You could probably build a little GUI application for that and integrate it as an external tool into PSS.

Cheers,
Bosparan
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Adding total function references to each defined function

Post by davidc »

You can use PowerShell Studio's Find All References command:
Find All References.png
Find All References.png (18.9 KiB) Viewed 2253 times
David
David
SAPIEN Technologies, Inc.
This topic is 7 years and 9 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked