Skip to content

pwd command. #604

Closed
Closed

Description

@andrasio

It'd be nice having our own pwd command. At the moment, doing pwd we get the expected behavior but if we enter a file, since the filesystem view becomes an abstraction and we use the current path to keep track where in the file we currently are, doing pwd will fail.

Reproducing:

> curl https://api.github.com/orgs/nushell | from-json | embed details
━━━━━━━━━━━━━━━━
 details
────────────────
 [table: 1 row]
━━━━━━━━━━━━━━━━

> curl https://api.github.com/orgs/nushell | from-json | embed details | save data.json
> enter data.json
/> ls
━━━━━━━━━━━━━━━━
 details
────────────────
 [table: 1 row]
━━━━━━━━━━━━━━━━

/> cd details
/details> ls | pick public_members_url
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 public_members_url
─────────────────────────────────────────────────────────────
 https://api.github.com/orgs/nushell/public_members{/member}
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

/details> pwd
error: No such file or directory (os error 2)

The expected behavior should be:

/details> pwd
/details

Activity

  1. sophiajt commented on Sep 7, 2019

    @sophiajt
    Contributor

    When can extend #612 to work with value shell also. We may want to create a new command in Shell for it. cc @wycats

  2. JonnyWalker81 commented on Sep 7, 2019

    @JonnyWalker81
    Contributor

    I was looking into this a little and thought that the pwd command would use the shell manager to get the current path for the current shell. If you are inside of a file (e.g. json or toml) it would know the correct path, while env::current_path would not. Am I on the right track with my understanding on how nushell works?

  3. andrasio commented on Sep 7, 2019

    @andrasio
    MemberAuthor

    @JonnyWalker81 You are on the right track señor. We still need to extend it to ValueShell. If you are interested, ideally pwd should be implemented in the shells like for example cd is.

  4. JonnyWalker81 commented on Sep 7, 2019

    @JonnyWalker81
    Contributor

    I will take a look, seems straightforward enough, but I am probably missing something. @androbtech Thank you for the hint and guidance.

  5. andrasio commented on Sep 7, 2019

    @andrasio
    MemberAuthor

    @JonnyWalker81 Full steam ahead, Capitán!

    @chhetripradeep @JonnyWalker81 More than welcome to see you guys join the Discord (link in the README)

  6. added a commit that references this issue on Feb 7, 2022
  7. added a commit that references this issue on Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions