Skip to content

External commands call output expectations. #666

Closed

Description

@andrasio

First released MVP we can do something like:

echo "$(git log --pretty=format:'%h|%s|%aN|%aE|%aD' -n 2)" | lines | split-column "|" commit subject name email date to get:

> echo "$(git log --pretty=format:'%h|%s|%aN|%aE|%aD' -n 2)" | lines | split-column "|" commit name
---+---------+-----------------------------------------------------------
 # | commit  | name
---+---------+-----------------------------------------------------------
 0 | 6551498 | Merge pull request #662 from jonathandturner/did_you_mean
 1 | 074a76c | Fix test
---+---------+-----------------------------------------------------------

> ^echo "$(git log --pretty=format:'%h|%s|%aN|%aE|%aD' -n 2)" | lines | split-column "|" commit name
---+---------+-----------------------------------------------------------
 # | commit  | name
---+---------+-----------------------------------------------------------
 0 | 6551498 | Merge pull request #662 from jonathandturner/did_you_mean
 1 | 074a76c | Fix test
---+---------+-----------------------------------------------------------

This is no longer possible because (with expected output) due to, possibly, the way we are giving output back.

With latest build from source we get:

> echo "$(git log --pretty=format:'%h|%s|%aN|%aE|%aD' -n 2)" | lines | split-column "|" commit name
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━
 commit                        │ name
───────────────────────────────┼──────
 $(git log --pretty=format:'%h │ %s
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━

> ^echo "$(git log --pretty=format:'%h|%s|%aN|%aE|%aD' -n 2)" | lines | split-column "|" commit name
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━
 commit                        │ name
───────────────────────────────┼──────
 $(git log --pretty=format:'%h │ %s
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━

This is possibly because our built-in echo simply prints to output the string. Escape valve no longer gives expected behavior (which does in first released MVP) either.

Activity

  1. changed the title [-]Escape valve command call.[/-] [+]Calling externals commands expectations.[/+] on Sep 13, 2019
  2. changed the title [-]Calling externals commands expectations.[/-] [+]External commands call output expectations.[/+] on Sep 13, 2019
  3. added
    status:investigate
    A:external-commands
    on Sep 13, 2019
  4. sophiajt commented on Sep 14, 2019

    @sophiajt
    Contributor

    If I'm reading this right, this used to work because we were working through bash rather than nu being its own shell.

    Have you tried calling out to sh with the text?

  5. wycats commented on Sep 14, 2019

    @wycats
    Contributor

    It seems surprising that ^echo didn't work, no?

  6. andrasio commented on Sep 14, 2019

    @andrasio
    MemberAuthor

    @jonathandturner

    > ^sh | lines | split-column "|" commit name
    nushell $ git log --pretty=format:'%h|%s|%aN|%aE|%aD' -n 2
    nushell $ exit
    exit
    ━━━┯━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
     # │ commit  │ name
    ───┼─────────┼────────────────────────────────────────────────
     0 │ 17fc568 │ Fixed lints
     1 │ 3b00049 │ Taking another stab at replacing Span with Tag
    ━━━┷━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    >
    
  7. andrasio commented on Sep 14, 2019

    @andrasio
    MemberAuthor

    @wycats Indeed. They work on the released version.

  8. added a commit that references this issue on Jan 27, 2023
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

    A:external-commandsstatus:investigate

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions