aboutsummaryrefslogtreecommitdiff
path: root/scripts/posh-vcpkg
diff options
context:
space:
mode:
authorBarath Kannan <barathsotd@gmail.com>2017-10-17 20:25:12 +1100
committerBarath Kannan <barathsotd@gmail.com>2017-10-17 20:25:12 +1100
commit48128e5b4dc964a306737e829affe349d8c6956c (patch)
tree414b608b8ad3037d0324bb77c83881c4306ef521 /scripts/posh-vcpkg
parentddc421acbc8bc9dd1d448190ac173b9d11e942dd (diff)
parent7ed8d4f75e903fdad4c02b4e784f2f4bcb30a3b0 (diff)
downloadvcpkg-48128e5b4dc964a306737e829affe349d8c6956c.tar.gz
vcpkg-48128e5b4dc964a306737e829affe349d8c6956c.zip
Merge branch 'master' of https://github.com/Microsoft/vcpkg into qt5_modular
Diffstat (limited to 'scripts/posh-vcpkg')
-rw-r--r--scripts/posh-vcpkg/0.0.1/posh-vcpkg.psd131
-rw-r--r--scripts/posh-vcpkg/0.0.1/posh-vcpkg.psm139
2 files changed, 70 insertions, 0 deletions
diff --git a/scripts/posh-vcpkg/0.0.1/posh-vcpkg.psd1 b/scripts/posh-vcpkg/0.0.1/posh-vcpkg.psd1
new file mode 100644
index 000000000..3fb94fe7d
--- /dev/null
+++ b/scripts/posh-vcpkg/0.0.1/posh-vcpkg.psd1
@@ -0,0 +1,31 @@
+@{
+
+# Script module or binary module file associated with this manifest.
+ModuleToProcess = 'posh-vcpkg.psm1'
+
+# Version number of this module.
+ModuleVersion = '0.0.1'
+
+# ID used to uniquely identify this module
+GUID = '948f02ab-fc99-4a53-8335-b6556eef129b'
+
+# Minimum version of the Windows PowerShell engine required by this module
+PowerShellVersion = '5.0'
+
+FunctionsToExport = @('TabExpansion')
+CmdletsToExport = @()
+VariablesToExport = @()
+AliasesToExport = @()
+
+# Private data to pass to the module specified in RootModule/ModuleToProcess.
+# This may also contain a PSData hashtable with additional module metadata used by PowerShell.
+PrivateData =
+@{
+ PSData =
+ @{
+ # Tags applied to this module. These help with module discovery in online galleries.
+ Tags = @('vcpkg', 'tab', 'tab-completion', 'tab-expansion', 'tabexpansion')
+ }
+}
+
+}
diff --git a/scripts/posh-vcpkg/0.0.1/posh-vcpkg.psm1 b/scripts/posh-vcpkg/0.0.1/posh-vcpkg.psm1
new file mode 100644
index 000000000..25ef99609
--- /dev/null
+++ b/scripts/posh-vcpkg/0.0.1/posh-vcpkg.psm1
@@ -0,0 +1,39 @@
+param()
+
+if (Get-Module posh-vcpkg) { return }
+
+if ($PSVersionTable.PSVersion.Major -lt 5) {
+ Write-Warning ("posh-vcpkg does not support PowerShell versions before 5.0.")
+ return
+}
+
+if (Test-Path Function:\TabExpansion) {
+ Rename-Item Function:\TabExpansion VcpkgTabExpansionBackup
+}
+
+function TabExpansion($line, $lastWord) {
+ $lastBlock = [regex]::Split($line, '[|;]')[-1].TrimStart()
+
+ switch -regex ($lastBlock) {
+ "^(?<vcpkgexe>(\./|\.\\|)vcpkg(\.exe|)) (?<remaining>.*)$"
+ {
+ & $matches['vcpkgexe'] autocomplete $matches['remaining']
+ return
+ }
+
+ # Fall back on existing tab expansion
+ default {
+ if (Test-Path Function:\VcpkgTabExpansionBackup) {
+ VcpkgTabExpansionBackup $line $lastWord
+ }
+ }
+ }
+}
+
+$exportModuleMemberParams = @{
+ Function = @(
+ 'TabExpansion'
+ )
+}
+
+Export-ModuleMember @exportModuleMemberParams