-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
6 changed files
with
41 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { exists, move } from "jsr:@std/fs"; | ||
|
||
export default async function setup() { | ||
const binPath = `${Deno.env.get("HOME")}/.drenv/bin/drenv`; | ||
const shell = Deno.env.get("SHELL"); | ||
|
||
if (await exists(binPath)) { | ||
return "drenv: already installed"; | ||
} else { | ||
if (!Deno.execPath().includes("drenv")) { | ||
return "drenv: this command must be run from the drenv executable" | ||
} | ||
|
||
await move(Deno.execPath(), binPath); | ||
|
||
console.log(`Installed at ${binPath}\n`); | ||
console.log(`Run the following to add drenv to your shell profile:\n`); | ||
|
||
if (shell?.includes("zsh")) { | ||
console.log(`echo 'export PATH="$HOME/.drenv/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc`); | ||
} else if (shell?.includes("bash")) { | ||
console.log(`echo 'export PATH="$HOME/.drenv/bin:$PATH"' >> ~/.bashrc && source ~/.bashrc`); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters