1
0
Fork 0
mirror of https://github.com/shimataro/ssh-key-action.git synced 2025-06-19 22:52:10 +10:00

* add lint tools (#61)

This commit is contained in:
shimataro 2020-01-18 09:56:30 +09:00 committed by GitHub
parent ab2b5fa346
commit a4ff38c616
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 2417 additions and 359 deletions

View file

@ -75,7 +75,7 @@ function main(): void
*/
function getHomeDirectory(): string
{
const homeEnv = process.platform == "win32" ? "USERPROFILE" : "HOME";
const homeEnv = getHomeEnv();
const home = process.env[homeEnv];
if(home === undefined)
{
@ -85,6 +85,22 @@ function getHomeDirectory(): string
return home;
}
/**
* get HOME environment name
* @returns HOME environment name
*/
function getHomeEnv(): string
{
if(process.platform === "win32")
{
// Windows
return "USERPROFILE";
}
// macOS / Linux
return "HOME";
}
/**
* prepend LF to value if not empty
* @param value the value to prepend LF