Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli,daemon): Add mkdir command #2288

Merged
merged 3 commits into from
May 15, 2024
Merged

feat(cli,daemon): Add mkdir command #2288

merged 3 commits into from
May 15, 2024

Conversation

rekmarks
Copy link
Contributor

@rekmarks rekmarks commented May 15, 2024

Adds mkdir command to the CLI. Updates the daemon's directory abstraction to accept pet name paths at makeDirectory().

> endo mkdir dir
> endo make counter.js -n dir.counter
> endo eval 'E(counter).incr()' counter:dir.counter
1

Base automatically changed from kriskowal-daemon-caplet-and-store-path to master May 15, 2024 20:16
@rekmarks rekmarks marked this pull request as ready for review May 15, 2024 20:53
@@ -453,7 +453,7 @@ export interface NameHub {
}

export interface EndoDirectory extends NameHub {
makeDirectory(petName: string): Promise<EndoDirectory>;
makeDirectory(...petNamePath: string[]): Promise<EndoDirectory>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine, but I have misgivings about throwing away the possibility of cleanly taking an options bag later that would be addressed by taking string | string[] here instead. I wouldn’t mind if lookup were very special and don’t love that it is special.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, we have actually accumulated a lot of these ...path signature functions:

export interface NameHub {
  has(...petNamePath: string[]): Promise<boolean>;
  identify(...petNamePath: string[]): Promise<string | undefined>;
  locate(...petNamePath: string[]): Promise<string | undefined>;
  reverseLocate(locator: string): Promise<string[]>;
  followLocatorNameChanges(
    locator: string,
  ): AsyncGenerator<LocatorNameChange, undefined, undefined>;
  list(...petNamePath: string[]): Promise<Array<string>>;
  listIdentifiers(...petNamePath: string[]): Promise<Array<string>>;
  followNameChanges(
    ...petNamePath: string[]
  ): AsyncGenerator<PetStoreNameChange, undefined, undefined>;
  lookup(...petNamePath: string[]): Promise<unknown>;
  reverseLookup(value: unknown): Array<string>;
  write(petNamePath: string | string[], id: string): Promise<void>;
  remove(...petNamePath: string[]): Promise<void>;
  move(fromPetName: string[], toPetName: string[]): Promise<void>;
  copy(fromPetName: string[], toPetName: string[]): Promise<void>;
}

export interface EndoDirectory extends NameHub {
  makeDirectory(...petNamePath: string[]): Promise<EndoDirectory>;
}

@rekmarks rekmarks merged commit 8f6d64f into master May 15, 2024
17 checks passed
@rekmarks rekmarks deleted the rekmarks-cli-mkdir branch May 15, 2024 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants