Skip to content

Commit

Permalink
Finalized v0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Gravifer committed Feb 23, 2021
1 parent 6c6aa28 commit 89f6bd1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
18 changes: 9 additions & 9 deletions posh-wakatime.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ''
Expand All @@ -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 = @()
Expand Down Expand Up @@ -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 = @()
Expand All @@ -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 = ''
Expand All @@ -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 = ''
Expand Down
13 changes: 5 additions & 8 deletions posh-wakatime.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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;}
Expand All @@ -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";

Expand All @@ -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
Expand All @@ -87,7 +85,6 @@ function Send-WakaTimeHeartbeat(){
} -ArgumentList $command, $gitFolder
}


function Send-HeartbeatAtPrompt() {
function global:prompt() {
Send-WakaTimeHeartbeat
Expand Down

0 comments on commit 89f6bd1

Please sign in to comment.