Verb and Noun

Welcome Forums General PowerShell Q&A Verb and Noun

This topic contains 4 replies, has 4 voices, and was last updated by

 
Participant
3 years, 8 months ago.

  • Author
    Posts
  • #22214

    Inactive
    Points: 0
    Rank: Member

    Guys,
    How can I define which is verb and noun in my script? skeleton of my .psm1 would be as below.

    Function Get-Foo
    {
    [cmdLetBinding()]
    BEGIN{}
    PROCESS{}
    END
    }

  • #22215

    Member
    Points: 0
    Rank: Member

    PowerShell does that automatically, as long as your function name contains a hyphen. Everything before the hyphen is the verb, everything after the hyphen is the noun.

  • #22218

    Participant
    Points: 0
    Rank: Member

    'Get' is a verb and 'Foo' is a noun.

  • #22219

    Inactive
    Points: 0
    Rank: Member

    thx team. understood.

  • #22250

    Participant
    Points: 0
    Rank: Member

    Just as an addition, PowerShell best practice recommends using a naming convention for the verb part from an 'approved' list. It's quite an extensive list .

    I've only found one situation where I was really struggling to choose the verb, and at the end of the day because my noun part wasn't particularly good.

    You can get a list of these verbs via :

    Get-Verb
    

The topic ‘Verb and Noun’ is closed to new replies.