From b7a38a0d74eaae6c7f3951c1112f124f0a4c7c69 Mon Sep 17 00:00:00 2001 From: Sina Ebrahimi <54502260+Sina-Ebrahimi@users.noreply.github.com> Date: Fri, 16 Oct 2020 08:54:29 -0700 Subject: [PATCH] add 'username' tag Get username of logged in user --- command.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/command.js b/command.js index 5b44f86..6965266 100644 --- a/command.js +++ b/command.js @@ -20,6 +20,7 @@ */ var vscode = require('vscode'); +var os = require('os'); function insertFileHeaderComment(picked_template){ var workspace = vscode.workspace, @@ -60,6 +61,7 @@ function insertFileHeaderComment(picked_template){ h = (date.getHours()+"").padStart(2, '0'), m = (date.getMinutes()+"").padStart(2, '0'), s = (date.getSeconds()+"").padStart(2, '0'), + username = os.userInfo().username, replace = { 'date': date.toDateString(), 'time': date.toLocaleTimeString(), @@ -68,6 +70,7 @@ function insertFileHeaderComment(picked_template){ 'month': date.getMonth()+1, 'year': date.getFullYear(), 'company': 'Your Company', + 'username': username, 'filename': vscode.window.activeTextEditor.document.fileName.replace(/^.*[\\\/]/, ''), 'hour': h, 'minute': m,