From 89f6bd1f5bc8103dedede6fa5017b3baf272a3d7 Mon Sep 17 00:00:00 2001 From: Gravifer Date: Tue, 23 Feb 2021 14:53:48 +0800 Subject: [PATCH] Finalized v0.1 --- posh-wakatime.psd1 | 18 +++++++++--------- posh-wakatime.psm1 | 13 +++++-------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/posh-wakatime.psd1 b/posh-wakatime.psd1 index 1e0a1be..7c0bd1f 100644 --- a/posh-wakatime.psd1 +++ b/posh-wakatime.psd1 @@ -21,19 +21,19 @@ ModuleVersion = '0.0.1' GUID = 'a8556d28-dab1-4144-b121-7c80dae1f561' # Author of this module -Author = 'FangTci' +Author = 'Gravifer' # Company or vendor of this module CompanyName = 'Unknown' # Copyright statement for this module -Copyright = '(c) FangTci. All rights reserved.' +Copyright = '(c) Gravifer. All rights reserved.' # Description of the functionality provided by this module -# Description = '' +Description = 'WakaTime plug-in for PowerShell' # Minimum version of the PowerShell engine required by this module -# PowerShellVersion = '' +PowerShellVersion = '5.0' # Name of the PowerShell host required by this module # PowerShellHostName = '' @@ -51,7 +51,7 @@ Copyright = '(c) FangTci. All rights reserved.' # ProcessorArchitecture = '' # Modules that must be imported into the global environment prior to importing this module -# RequiredModules = @() +RequiredModules = @("posh-git") # Assemblies that must be loaded prior to importing this module # RequiredAssemblies = @() @@ -84,7 +84,7 @@ AliasesToExport = @() # DscResourcesToExport = @() # List of all modules packaged with this module -# ModuleList = @() +ModuleList = @("posh-wakatime") # List of all files packaged with this module # FileList = @() @@ -95,13 +95,13 @@ PrivateData = @{ PSData = @{ # Tags applied to this module. These help with module discovery in online galleries. - # Tags = @() + # Tags = @("") # A URL to the license for this module. # LicenseUri = '' # A URL to the main website for this project. - # ProjectUri = '' + ProjectUri = 'https://github.com/Gravifer/pwsh-wakatime' # A URL to an icon representing this module. # IconUri = '' @@ -123,7 +123,7 @@ PrivateData = @{ } # End of PrivateData hashtable # HelpInfo URI of this module -# HelpInfoURI = '' +# HelpInfoURI = 'https://github.com/Gravifer/pwsh-wakatime' # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. # DefaultCommandPrefix = '' diff --git a/posh-wakatime.psm1 b/posh-wakatime.psm1 index 02e43d9..16319e4 100644 --- a/posh-wakatime.psm1 +++ b/posh-wakatime.psm1 @@ -33,7 +33,7 @@ if (Test-Path Function:\prompt) { function Test-Wakatime {return $(if($(where.exe wakatime)) {$True} else {$False})} -if (!$env:wakaDebug) {$env:wakaDebug = $False} +if (!$env:wakaDebug) {$env:wakaDebug = $True} function Send-WakaTimeHeartbeat(){ if (!$(where.exe wakatime)) {return;} @@ -55,9 +55,7 @@ function Send-WakaTimeHeartbeat(){ Write-Host "Sending wakatime" Write-Host "Waka command: $command" - if($command -eq "") { - return; - } + if($command -eq "") {return;} $PLUGIN_VERSION = "0.1"; @@ -67,16 +65,16 @@ function Send-WakaTimeHeartbeat(){ $wakaCommand+= ' --entity "' $wakaCommand+= $command $wakaCommand+= '" ' - $wakaCommand+= ' --language "PowerShell"' + $wakaCommand+= ' --language "PowerShell" ' if($null -eq $gitFolder){ - $wakaCommand =$wakaCommand + ' --project "' + $wakaCommand =$wakaCommand + ' --project ' $wakaCommand =$wakaCommand + 'Terminal' } else { $gitFolder = (Get-Item ($gitFolder).Replace(".git","")) $wakaCommand =$wakaCommand + ' --project "' $wakaCommand =$wakaCommand + $gitFolder.Name - $wakaCommand =$wakaCommand + '"' + $wakaCommand =$wakaCommand + '" ' } Write-Host "wakaDebug: $Env:wakaDebug" $wakaCommand @@ -87,7 +85,6 @@ function Send-WakaTimeHeartbeat(){ } -ArgumentList $command, $gitFolder } - function Send-HeartbeatAtPrompt() { function global:prompt() { Send-WakaTimeHeartbeat