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:
parent
ab2b5fa346
commit
a4ff38c616
8 changed files with 2417 additions and 359 deletions
18
src/main.ts
18
src/main.ts
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue