ค้นหาเว็บไซต์

วิธีเพิ่มประเภทอินพุตให้กับหัวข้อวิธีใช้ cmdlet


บันทึก

การเขียนวิธีใช้ XML ด้วยตนเองเป็นเรื่องยากมาก โมดูล PlatyPS ช่วยให้คุณสามารถเขียนความช่วยเหลือใน Markdown แล้วแปลงเป็นความช่วยเหลือแบบ XML ทำให้เขียนและดูแลรักษาความช่วยเหลือได้ง่ายขึ้นมาก PlatyPS ยังสามารถสร้างแพ็คเกจความช่วยเหลือที่อัปเดตได้ให้กับคุณอีกด้วย สำหรับข้อมูลเพิ่มเติม โปรดดูสร้างวิธีใช้แบบ XML โดยใช้ PlatyPS

ส่วนนี้อธิบายวิธีการเพิ่มส่วน อินพุต ในหัวข้อวิธีใช้ PowerShell cmdlet ส่วน INPUTS แสดงรายการคลาส .NET ของออบเจ็กต์ที่ cmdlet ยอมรับเป็นอินพุตจากไปป์ไลน์ ตามค่าหรือตามชื่อคุณสมบัติ

คุณสามารถเพิ่มคลาสลงในส่วน INPUTS ได้ไม่จำกัด ประเภทอินพุตจะอยู่ในโหนด <command:inputTypes> โดยแต่ละคลาสจะอยู่ในองค์ประกอบ <command:inputType>

สคีมาประกอบด้วยองค์ประกอบ <maml:description> สององค์ประกอบในองค์ประกอบ <command:inputType> แต่ละรายการ อย่างไรก็ตาม Get-Help cmdlet จะแสดงเฉพาะเนื้อหาขององค์ประกอบ <command:inputType>/

เริ่มต้นใน PowerShell 3.0 Get-Help cmdlet จะแสดงเนื้อหาขององค์ประกอบ <maml:uri> องค์ประกอบนี้ช่วยให้คุณนำผู้ใช้ไปยังหัวข้อที่อธิบายคลาส .NET

XML ต่อไปนี้แสดงโหนด <maml:inputTypes>

<command:inputTypes>
  <command:inputType>
    <dev:type>
      <maml:name> Class name </maml:name>
      <maml:uri>  URI of a topic that describes the class </maml:uri>
      <maml:description/>
    </dev:type>
    <maml:description>
      <maml:para> Brief description </maml:para>
    </maml:description>
  </command:inputType>
</command:inputTypes>

XML ต่อไปนี้แสดงตัวอย่างของการใช้โหนด <maml:inputTypes> เพื่อจัดทำเอกสารประเภทอินพุต

<command:inputTypes>
  <command:inputType>
    <dev:type>
      <maml:name>System.DateTime</maml:name>
      <maml:uri>https://learn.microsoft.com/dotnet/api/system.datetime</maml:uri>
      <maml:description/>
    </dev:type>
    <maml:description>
      <maml:para> You can pipe a date to the Set-Date cmdlet. <maml:para>
    <maml:description>
  </command:inputType>
</command:inputTypes>

บทความที่เกี่ยวข้อง