Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanwhit committed Sep 16, 2024
1 parent 4d79fe5 commit 37dfbaf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
7 changes: 2 additions & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const {
writeTextFile,
} = environment;

type CompletionWriteResult = "fail" | "success" | "up-to-date" | null;
type CompletionWriteResult = "fail" | "success" | null;

async function writeCompletionFiles(
availableShells: UnixShell[],
Expand Down Expand Up @@ -74,10 +74,8 @@ async function writeCompletionFiles(
);
}
await writeTextFile(completionFilePath, completionFileContents);
results.push("success");
} else {
results.push("up-to-date");
}
results.push("success");
written.add(completionFilePath);
} catch (error) {
warn(`Failed to install completions for ${shell.name}: ${error}`);
Expand Down Expand Up @@ -150,7 +148,6 @@ async function updateRcFile(
sourceString: string | SourceStringInfo,
backups: Backups,
): Promise<boolean> {
console.log("updating rc", rc);
let prepend: string | undefined;
let append: string | undefined;
if (typeof sourceString === "string") {
Expand Down
5 changes: 3 additions & 2 deletions src/shell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export class Zsh implements UnixShell {
const filePath = await this.completionsFilePath();
const completionDir = dirname(filePath);
const fpathSetup =
`if [[ ":$FPATH:" != *":${completionDir}:"* ]]; then export FPATH="${completionDir}:$FPATH"; fi`;
`# Add deno completions to search path\nif [[ ":$FPATH:" != *":${completionDir}:"* ]]; then export FPATH="${completionDir}:$FPATH"; fi`;

const zshDotDir = await this.getZshDotDir() ?? homeDir;
// try to figure out whether the user already has `compinit` being called
Expand All @@ -199,7 +199,8 @@ export class Zsh implements UnixShell {
(f) => pathExists(join(zshDotDir, f)),
)).length == 0
) {
append = "autoload -Uz compinit\ncompinit";
append =
"# Initialize zsh completions (added by deno install script)\nautoload -Uz compinit\ncompinit";
}
return {
prepend: fpathSetup,
Expand Down

0 comments on commit 37dfbaf

Please sign in to comment.