Skip to content
This repository was archived by the owner on May 21, 2019. It is now read-only.

Commit 830f4f2

Browse files
committed
Rename cwd to pwd. Fixes #522. [ci skip].
1 parent 6dea542 commit 830f4f2

File tree

14 files changed

+32
-32
lines changed

14 files changed

+32
-32
lines changed

src/Autocompletion.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const getSuggestions = async (job: Job, caretPosition: number) => {
77
const node = leafNodeAt(caretPosition, job.prompt.ast);
88
const suggestions = await node.suggestions({
99
environment: job.environment,
10-
historicalCurrentDirectoriesStack: job.session.historicalCurrentDirectoriesStack,
10+
historicalPresentDirectoriesStack: job.session.historicalPresentDirectoriesStack,
1111
aliases: job.session.aliases,
1212
});
1313

src/Command.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const executors: Dictionary<(i: Job, a: string[]) => void> = {
1717
const enteredPath = args[0];
1818

1919
if (isHistoricalDirectory(enteredPath)) {
20-
fullPath = expandHistoricalDirectory(enteredPath, job.session.historicalCurrentDirectoriesStack);
20+
fullPath = expandHistoricalDirectory(enteredPath, job.session.historicalPresentDirectoriesStack);
2121
} else {
2222
fullPath = job.environment.cdpath
2323
.map(path => resolveDirectory(path, enteredPath))

src/Interfaces.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export interface Attributes {
2626

2727
export interface PreliminarySuggestionContext {
2828
readonly environment: Environment;
29-
readonly historicalCurrentDirectoriesStack: OrderedSet<string>;
29+
readonly historicalPresentDirectoriesStack: OrderedSet<string>;
3030
readonly aliases: Aliases;
3131
}
3232

@@ -55,8 +55,8 @@ export interface OutputDecorator {
5555
}
5656

5757
export interface EnvironmentObserverPlugin {
58-
currentWorkingDirectoryWillChange: (session: Session, directory: string) => void;
59-
currentWorkingDirectoryDidChange: (session: Session, directory: string) => void;
58+
presentWorkingDirectoryWillChange: (session: Session, directory: string) => void;
59+
presentWorkingDirectoryDidChange: (session: Session, directory: string) => void;
6060
}
6161

6262
export interface PreexecPlugin {

src/Session.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {ApplicationComponent} from "./views/1_ApplicationComponent";
88
import {Environment, processEnvironment} from "./Environment";
99
import {
1010
homeDirectory, normalizeDirectory, writeFileCreatingParents,
11-
currentWorkingDirectoryFilePath, historyFilePath,
11+
presentWorkingDirectoryFilePath, historyFilePath,
1212
} from "./utils/Common";
1313
import {remote} from "electron";
1414
import {OrderedSet} from "./utils/OrderedSet";
@@ -19,7 +19,7 @@ export class Session extends EmitterWithUniqueID {
1919
readonly environment = new Environment(processEnvironment);
2020
readonly aliases = new Aliases(aliasesFromConfig);
2121
history = History;
22-
historicalCurrentDirectoriesStack = new OrderedSet<string>();
22+
historicalPresentDirectoriesStack = new OrderedSet<string>();
2323

2424
constructor(private application: ApplicationComponent, private _dimensions: Dimensions) {
2525
super();
@@ -79,19 +79,19 @@ export class Session extends EmitterWithUniqueID {
7979
}
8080

8181
PluginManager.environmentObservers.forEach(observer =>
82-
observer.currentWorkingDirectoryWillChange(this, normalizedDirectory)
82+
observer.presentWorkingDirectoryWillChange(this, normalizedDirectory)
8383
);
8484

8585
this.environment.pwd = normalizedDirectory;
86-
this.historicalCurrentDirectoriesStack.prepend(normalizedDirectory);
86+
this.historicalPresentDirectoriesStack.prepend(normalizedDirectory);
8787

8888
PluginManager.environmentObservers.forEach(observer =>
89-
observer.currentWorkingDirectoryDidChange(this, normalizedDirectory)
89+
observer.presentWorkingDirectoryDidChange(this, normalizedDirectory)
9090
);
9191
}
9292

9393
private serialize() {
94-
writeFileCreatingParents(currentWorkingDirectoryFilePath, JSON.stringify(this.directory)).then(
94+
writeFileCreatingParents(presentWorkingDirectoryFilePath, JSON.stringify(this.directory)).then(
9595
() => void 0,
9696
(error: any) => { if (error) throw error; }
9797
);
@@ -103,7 +103,7 @@ export class Session extends EmitterWithUniqueID {
103103
};
104104

105105
private deserialize(): void {
106-
this.directory = this.readSerialized(currentWorkingDirectoryFilePath, homeDirectory);
106+
this.directory = this.readSerialized(presentWorkingDirectoryFilePath, homeDirectory);
107107
History.deserialize(this.readSerialized(historyFilePath, []));
108108
}
109109

src/plugins/DotEnvLoader.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import {exists} from "../utils/Common";
55
import {sourceFile} from "../Command";
66

77
PluginManager.registerEnvironmentObserver({
8-
currentWorkingDirectoryWillChange: () => void 0,
9-
currentWorkingDirectoryDidChange: async(session: Session, directory: string) => {
8+
presentWorkingDirectoryWillChange: () => void 0,
9+
presentWorkingDirectoryDidChange: async(session: Session, directory: string) => {
1010
if (await exists(Path.join(directory, ".env"))) {
1111
sourceFile(session, ".env");
1212
}

src/plugins/GitWatcher.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ interface WatchesValue {
7777
class WatchManager implements EnvironmentObserverPlugin {
7878
directoryToDetails: Map<string, WatchesValue> = new Map();
7979

80-
currentWorkingDirectoryWillChange(session: Session, newDirectory: string) {
80+
presentWorkingDirectoryWillChange(session: Session, newDirectory: string) {
8181
const oldDirectory = session.directory;
8282

8383
if (!this.directoryToDetails.has(oldDirectory)) {
@@ -93,7 +93,7 @@ class WatchManager implements EnvironmentObserverPlugin {
9393
}
9494
}
9595

96-
currentWorkingDirectoryDidChange(session: Session, directory: string) {
96+
presentWorkingDirectoryDidChange(session: Session, directory: string) {
9797
if (this.directoryToDetails.has(directory)) {
9898
this.directoryToDetails.get(directory)!.sessions.add(session);
9999
} else {

src/plugins/NVM.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ async function withNvmPath(directory: string, callback: (path: string) => void)
1313
}
1414

1515
PluginManager.registerEnvironmentObserver({
16-
currentWorkingDirectoryWillChange: async(session: Session) => {
16+
presentWorkingDirectoryWillChange: async(session: Session) => {
1717
withNvmPath(session.directory, path => session.environment.path.remove(path));
1818
},
19-
currentWorkingDirectoryDidChange: async(session: Session, directory: string) => {
19+
presentWorkingDirectoryDidChange: async(session: Session, directory: string) => {
2020
withNvmPath(directory, path => session.environment.path.prepend(path));
2121
},
2222
});

src/plugins/PWDOperatingSystemIntegrator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import {PluginManager} from "../PluginManager";
33
import {remote} from "electron";
44

55
PluginManager.registerEnvironmentObserver({
6-
currentWorkingDirectoryWillChange: () => { /* do nothing */ },
6+
presentWorkingDirectoryWillChange: () => { /* do nothing */ },
77

8-
currentWorkingDirectoryDidChange: (session: Session, directory: string) => {
8+
presentWorkingDirectoryDidChange: (session: Session, directory: string) => {
99
remote.app.addRecentDocument(directory);
1010
},
1111
});

src/plugins/RVM.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ async function withRvmData(directory: string, callback: (binPaths: string[], gem
5151
}
5252

5353
PluginManager.registerEnvironmentObserver({
54-
currentWorkingDirectoryWillChange: () => async(session: Session, directory: string) => {
54+
presentWorkingDirectoryWillChange: () => async(session: Session, directory: string) => {
5555
withRvmData(directory, binPaths => {
5656
binPaths.forEach(path => session.environment.path.remove(path));
5757

@@ -61,7 +61,7 @@ PluginManager.registerEnvironmentObserver({
6161
});
6262
});
6363
},
64-
currentWorkingDirectoryDidChange: async(session: Session, directory: string) => {
64+
presentWorkingDirectoryDidChange: async(session: Session, directory: string) => {
6565
withRvmData(directory, (binPaths, gemPaths) => {
6666
binPaths.forEach(path => session.environment.path.prepend(path));
6767

src/plugins/autocompletion_providers/Cd.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ PluginManager.registerAutocompletionProvider("cd", async(context) => {
88
let suggestions: Suggestion[] = [];
99

1010
if (context.argument.value.startsWith("-")) {
11-
const historicalDirectoryAliases = _.take(["-", "-2", "-3", "-4", "-5", "-6", "-7", "-8", "-9"], context.historicalCurrentDirectoriesStack.size)
12-
.map(alias => new Suggestion().withValue(alias).withDescription(expandHistoricalDirectory(alias, context.historicalCurrentDirectoriesStack)).withStyle(styles.directory));
11+
const historicalDirectoryAliases = _.take(["-", "-2", "-3", "-4", "-5", "-6", "-7", "-8", "-9"], context.historicalPresentDirectoriesStack.size)
12+
.map(alias => new Suggestion().withValue(alias).withDescription(expandHistoricalDirectory(alias, context.historicalPresentDirectoriesStack)).withStyle(styles.directory));
1313

1414
suggestions.push(...historicalDirectoryAliases);
1515
}

0 commit comments

Comments
 (0)