Skip to main content
added 5 characters in body
Source Link
user194860
  • 209
  • 2
  • 6

I want Nu to find some files for me, filter them and pass them to an external program. For example: "Revert all files whose name contains 'GENERATED' with Git." I tried several variants, but none of them work:

# Doesn't pass the files:
ls --all --full-paths **/* | find GENERATED | git checkout --

# Returns an error: "Cannot convert record<name: string, type: string, size: filesize, modified: date> to a string"
ls --all --full-paths **/* | find GENERATED | each { |it| git checkout -- $it }

# Returns an error for every file: "error: Path specification »?[37m/home/xxx/com.?[0m?[41;37mgwt?[0m?[37mplugins.?[0m?[41;37mgwt?[0m?[37m.eclipse.core.prefs?[0m« does not match any file known to git" [Manually translated into English]
ls --all --full-paths **/* | find GENERATED | each { |it| git checkout -- $it.name }

What is the right way to do that in Nu?

I know how to do that with Bash. This question is just about Nu. :-)

I want Nu to find some files for me, filter them and pass them to an external program. For example: "Revert all files whose name contains 'GENERATED' with Git." I tried several variants, but none of them work:

# Doesn't pass the files:
ls --all --full-paths **/* | find GENERATED | git checkout --

# Returns an error: "Cannot convert record<name: string, type: string, size: filesize, modified: date> to a string"
ls --all --full-paths **/* | find GENERATED | each { |it| git checkout -- $it }

# Returns an error for every file: "error: Path specification »?[37m/home/xxx/com.?[0m?[41;37mgwt?[0m?[37mplugins.?[0m?[41;37mgwt?[0m?[37m.eclipse.core.prefs?[0m« does not match any file known to git" [Manually translated into English]
ls --all --full-paths **/* | find GENERATED | each { |it| git checkout -- $it }

What is the right way to do that in Nu?

I know how to do that with Bash. This question is just about Nu. :-)

I want Nu to find some files for me, filter them and pass them to an external program. For example: "Revert all files whose name contains 'GENERATED' with Git." I tried several variants, but none of them work:

# Doesn't pass the files:
ls --all --full-paths **/* | find GENERATED | git checkout --

# Returns an error: "Cannot convert record<name: string, type: string, size: filesize, modified: date> to a string"
ls --all --full-paths **/* | find GENERATED | each { |it| git checkout -- $it }

# Returns an error for every file: "error: Path specification »?[37m/home/xxx/com.?[0m?[41;37mgwt?[0m?[37mplugins.?[0m?[41;37mgwt?[0m?[37m.eclipse.core.prefs?[0m« does not match any file known to git" [Manually translated into English]
ls --all --full-paths **/* | find GENERATED | each { |it| git checkout -- $it.name }

What is the right way to do that in Nu?

I know how to do that with Bash. This question is just about Nu. :-)

Source Link
user194860
  • 209
  • 2
  • 6

nushell: pass list of filtered files to external program

I want Nu to find some files for me, filter them and pass them to an external program. For example: "Revert all files whose name contains 'GENERATED' with Git." I tried several variants, but none of them work:

# Doesn't pass the files:
ls --all --full-paths **/* | find GENERATED | git checkout --

# Returns an error: "Cannot convert record<name: string, type: string, size: filesize, modified: date> to a string"
ls --all --full-paths **/* | find GENERATED | each { |it| git checkout -- $it }

# Returns an error for every file: "error: Path specification »?[37m/home/xxx/com.?[0m?[41;37mgwt?[0m?[37mplugins.?[0m?[41;37mgwt?[0m?[37m.eclipse.core.prefs?[0m« does not match any file known to git" [Manually translated into English]
ls --all --full-paths **/* | find GENERATED | each { |it| git checkout -- $it }

What is the right way to do that in Nu?

I know how to do that with Bash. This question is just about Nu. :-)