Skip to content

Commit 52b1320

Browse files
committed
Auto merge of rust-lang#13126 - lukas-code:bashcomp, r=weihanglo
fix bash completion in directory with spaces ### What does this PR try to resolve? This PR fixes bash completion for `cargo run --bin <TAB>` when the path to the project contains a space. ### How should we test and review this PR? 1. create a project in a directory with a space, for example `mkdir '/tmp/has space' && cd '/tmp/has space' && cargo new foo && cd foo`. 2. add a binary to Cargo.toml, e.g. ``` [[bin]] name = "bar" ``` 3. on bash, type `cargo run --bin b` and press tab 4. observe error message `bash: $manifest: ambiguous redirect`, command is not completed 5. apply the fix to `$(rustc --print sysroot)/etc/bash_completion.d/cargo` 6. repeat step 3 and observe that the command is completed successfully
2 parents 64266c8 + 5853e99 commit 52b1320

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/etc/cargo.bashcomp.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,12 @@ _get_names_from_array()
209209
line=${line##*=}
210210
line=${line%%\"}
211211
line=${line##*\"}
212-
names+=($line)
212+
names+=("$line")
213213
fi
214214
fi
215215

216216
last_line=$line
217-
done < $manifest
217+
done < "$manifest"
218218
echo "${names[@]}"
219219
}
220220

0 commit comments

Comments
 (0)