TAILIEUCHUNG - Professional Windows PowerShell Programming phần 5

hoặc loại bỏ các snap-in để đạt được các bộ chính xác của các nhà cung cấp và Chương này đầu tiên giới thiệu hai loại PowerShell snap-in và mô tả khi nào sử dụng mỗi một. Sau đó nó cho thấy bạn từng bước làm thế nào | Chapter 4 Developing Cmdlets This is an example of binding -FileInfo parameter of Touch-File cmdlet to pipeline object RELATED LINKS Get-ChildItem As shown in the preceding example different sections of help output roughly correspond to sections in the help file. Best Practices for Cmdlet Development The goal of cmdlet development is to release a useful cmdlet to users. In this section we discuss some best practices for cmdlet development to make the cmdlet user s life easier. Naming Conventions The most visible part of a cmdlet is its name which include a verb and a noun and related syntax. Since cmdlet users can literally get thousands of cmdlets from different vendors it is important to name cmdlet verbs nouns and parameters consistently. That enables the usage of cmdlets to become more intuitive. Cmdlet Verb Name The cmdlet verb when chosen carefully can provide a clear indication of what the cmdlet does. Conversely if the verb is not chosen properly it can be very confusing to cmdlet users. Because of this the PowerShell team has compiled a list of recommended verbs which are available in Appendix B of this book. Following are some general guidelines Select verbs from the recommended list if possible. Avoid using synonyms of verbs in the recommended list. When developing a set of cmdlets related with one noun for example get-service and setservice select verbs from related verbsets in the recommended list. Cmdlet Noun Name The cmdlet noun describes the data that the cmdlet is processing. As with the cmdlet verb the cmdlet noun needs to be descriptive and avoid confusion with other domains. Following are some guidelines from the PowerShell team regarding the naming of nouns Always use the singular version of a noun for example use get-user instead of get-users. Use Pascal case for nouns in the cmdlet declaration. Even though PowerShell is case insensitive it will preserve the cmdlet name casing when presenting information about the cmdlet. Using Pascal case .

TỪ KHÓA LIÊN QUAN
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.