You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

209 lines
7.3 KiB

7 months ago
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>CodeMirror: Powershell mode</title>
  6. <link rel="stylesheet" href="../../doc/docs.css">
  7. <link rel="stylesheet" href="../../lib/codemirror.css">
  8. <script src="../../lib/codemirror.js"></script>
  9. <script src="../../addon/edit/matchbrackets.js"></script>
  10. <script src="powershell.js"></script>
  11. <style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
  12. </head>
  13. <body>
  14. <div id=nav>
  15. <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
  16. <ul>
  17. <li><a href="../../index.html">Home</a>
  18. <li><a href="../../doc/manual.html">Manual</a>
  19. <li><a href="https://github.com/codemirror/codemirror5">Code</a>
  20. </ul>
  21. <ul>
  22. <li><a href="../index.html">Language modes</a>
  23. <li><a class=active href="#">JavaScript</a>
  24. </ul>
  25. </div>
  26. <article>
  27. <h2>PowerShell mode</h2>
  28. <div><textarea id="code" name="code">
  29. # Paths
  30. cd c:\
  31. c:\windows\calc.exe
  32. # Number Literals
  33. 0 12345
  34. 12kb 12mb 12gB 12Tb 12PB 12L 12D 12lkb 12dtb
  35. 1.234 1.234e56 1. 1.e2 .2 .2e34
  36. 1.2MB 1.kb .1dTb 1.e1gb
  37. 0x1 0xabcdef 0x3tb 0xelmb
  38. # String Literals
  39. 'Literal escaping'''
  40. 'Literal $variable'
  41. "Escaping 1`""
  42. "Escaping 2"""
  43. "Escaped `$variable"
  44. "Text, $variable and more text"
  45. "Text, ${variable with spaces} and more text."
  46. "Text, $($expression + 3) and more text."
  47. "Text, $("interpolation $("inception")") and more text."
  48. @"
  49. Multiline
  50. string
  51. "@
  52. # --
  53. @"
  54. Multiline
  55. string with quotes "'
  56. "@
  57. # --
  58. @'
  59. Multiline literal
  60. string with quotes "'
  61. '@
  62. # Array and Hash literals
  63. @( 'a','b','c' )
  64. @{ 'key': 'value' }
  65. # Variables
  66. $Variable = 5
  67. $global:variable = 5
  68. ${Variable with spaces} = 5
  69. # Operators
  70. = += -= *= /= %=
  71. ++ -- .. -f * / % + -
  72. -not ! -bnot
  73. -split -isplit -csplit
  74. -join
  75. -is -isnot -as
  76. -eq -ieq -ceq -ne -ine -cne
  77. -gt -igt -cgt -ge -ige -cge
  78. -lt -ilt -clt -le -ile -cle
  79. -like -ilike -clike -notlike -inotlike -cnotlike
  80. -match -imatch -cmatch -notmatch -inotmatch -cnotmatch
  81. -contains -icontains -ccontains -notcontains -inotcontains -cnotcontains
  82. -replace -ireplace -creplace
  83. -band -bor -bxor
  84. -and -or -xor
  85. # Punctuation
  86. () [] {} , : ` = ; .
  87. # Keywords
  88. elseif begin function for foreach return else trap while do data dynamicparam
  89. until end break if throw param continue finally in switch exit filter from try
  90. process catch
  91. # Built-in variables
  92. $$ $? $^ $_
  93. $args $ConfirmPreference $ConsoleFileName $DebugPreference $Error
  94. $ErrorActionPreference $ErrorView $ExecutionContext $false $FormatEnumerationLimit
  95. $HOME $Host $input $MaximumAliasCount $MaximumDriveCount $MaximumErrorCount
  96. $MaximumFunctionCount $MaximumHistoryCount $MaximumVariableCount $MyInvocation
  97. $NestedPromptLevel $null $OutputEncoding $PID $PROFILE $ProgressPreference
  98. $PSBoundParameters $PSCommandPath $PSCulture $PSDefaultParameterValues
  99. $PSEmailServer $PSHOME $PSScriptRoot $PSSessionApplicationName
  100. $PSSessionConfigurationName $PSSessionOption $PSUICulture $PSVersionTable $PWD
  101. $ShellId $StackTrace $true $VerbosePreference $WarningPreference $WhatIfPreference
  102. $true $false $null
  103. # Built-in functions
  104. A:
  105. Add-Computer Add-Content Add-History Add-Member Add-PSSnapin Add-Type
  106. B:
  107. C:
  108. Checkpoint-Computer Clear-Content Clear-EventLog Clear-History Clear-Host Clear-Item
  109. Clear-ItemProperty Clear-Variable Compare-Object Complete-Transaction Connect-PSSession
  110. ConvertFrom-Csv ConvertFrom-Json ConvertFrom-SecureString ConvertFrom-StringData
  111. Convert-Path ConvertTo-Csv ConvertTo-Html ConvertTo-Json ConvertTo-SecureString
  112. ConvertTo-Xml Copy-Item Copy-ItemProperty
  113. D:
  114. Debug-Process Disable-ComputerRestore Disable-PSBreakpoint Disable-PSRemoting
  115. Disable-PSSessionConfiguration Disconnect-PSSession
  116. E:
  117. Enable-ComputerRestore Enable-PSBreakpoint Enable-PSRemoting Enable-PSSessionConfiguration
  118. Enter-PSSession Exit-PSSession Export-Alias Export-Clixml Export-Console Export-Counter
  119. Export-Csv Export-FormatData Export-ModuleMember Export-PSSession
  120. F:
  121. ForEach-Object Format-Custom Format-List Format-Table Format-Wide
  122. G:
  123. Get-Acl Get-Alias Get-AuthenticodeSignature Get-ChildItem Get-Command Get-ComputerRestorePoint
  124. Get-Content Get-ControlPanelItem Get-Counter Get-Credential Get-Culture Get-Date
  125. Get-Event Get-EventLog Get-EventSubscriber Get-ExecutionPolicy Get-FormatData Get-Help
  126. Get-History Get-Host Get-HotFix Get-Item Get-ItemProperty Get-Job Get-Location Get-Member
  127. Get-Module Get-PfxCertificate Get-Process Get-PSBreakpoint Get-PSCallStack Get-PSDrive
  128. Get-PSProvider Get-PSSession Get-PSSessionConfiguration Get-PSSnapin Get-Random Get-Service
  129. Get-TraceSource Get-Transaction Get-TypeData Get-UICulture Get-Unique Get-Variable Get-Verb
  130. Get-WinEvent Get-WmiObject Group-Object
  131. H:
  132. help
  133. I:
  134. Import-Alias Import-Clixml Import-Counter Import-Csv Import-LocalizedData Import-Module
  135. Import-PSSession ImportSystemModules Invoke-Command Invoke-Expression Invoke-History
  136. Invoke-Item Invoke-RestMethod Invoke-WebRequest Invoke-WmiMethod
  137. J:
  138. Join-Path
  139. K:
  140. L:
  141. Limit-EventLog
  142. M:
  143. Measure-Command Measure-Object mkdir more Move-Item Move-ItemProperty
  144. N:
  145. New-Alias New-Event New-EventLog New-Item New-ItemProperty New-Module New-ModuleManifest
  146. New-Object New-PSDrive New-PSSession New-PSSessionConfigurationFile New-PSSessionOption
  147. New-PSTransportOption New-Service New-TimeSpan New-Variable New-WebServiceProxy
  148. New-WinEvent
  149. O:
  150. oss Out-Default Out-File Out-GridView Out-Host Out-Null Out-Printer Out-String
  151. P:
  152. Pause Pop-Location prompt Push-Location
  153. Q:
  154. R:
  155. Read-Host Receive-Job Receive-PSSession Register-EngineEvent Register-ObjectEvent
  156. Register-PSSessionConfiguration Register-WmiEvent Remove-Computer Remove-Event
  157. Remove-EventLog Remove-Item Remove-ItemProperty Remove-Job Remove-Module
  158. Remove-PSBreakpoint Remove-PSDrive Remove-PSSession Remove-PSSnapin Remove-TypeData
  159. Remove-Variable Remove-WmiObject Rename-Computer Rename-Item Rename-ItemProperty
  160. Reset-ComputerMachinePassword Resolve-Path Restart-Computer Restart-Service
  161. Restore-Computer Resume-Job Resume-Service
  162. S:
  163. Save-Help Select-Object Select-String Select-Xml Send-MailMessage Set-Acl Set-Alias
  164. Set-AuthenticodeSignature Set-Content Set-Date Set-ExecutionPolicy Set-Item
  165. Set-ItemProperty Set-Location Set-PSBreakpoint Set-PSDebug
  166. Set-PSSessionConfiguration Set-Service Set-StrictMode Set-TraceSource Set-Variable
  167. Set-WmiInstance Show-Command Show-ControlPanelItem Show-EventLog Sort-Object
  168. Split-Path Start-Job Start-Process Start-Service Start-Sleep Start-Transaction
  169. Start-Transcript Stop-Computer Stop-Job Stop-Process Stop-Service Stop-Transcript
  170. Suspend-Job Suspend-Service
  171. T:
  172. TabExpansion2 Tee-Object Test-ComputerSecureChannel Test-Connection
  173. Test-ModuleManifest Test-Path Test-PSSessionConfigurationFile Trace-Command
  174. U:
  175. Unblock-File Undo-Transaction Unregister-Event Unregister-PSSessionConfiguration
  176. Update-FormatData Update-Help Update-List Update-TypeData Use-Transaction
  177. V:
  178. W:
  179. Wait-Event Wait-Job Wait-Process Where-Object Write-Debug Write-Error Write-EventLog
  180. Write-Host Write-Output Write-Progress Write-Verbose Write-Warning
  181. X:
  182. Y:
  183. Z:</textarea></div>
  184. <script>
  185. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  186. mode: "powershell",
  187. lineNumbers: true,
  188. indentUnit: 4,
  189. tabMode: "shift",
  190. matchBrackets: true
  191. });
  192. </script>
  193. <p><strong>MIME types defined:</strong> <code>application/x-powershell</code>.</p>
  194. </article>
  195. </body>
  196. </html>