rust-lang / rustdoc-types

Rustdoc's JSON output interface
Apache License 2.0
28 stars 15 forks source link

update.sh: Make user, repo, and branch easy to change #14

Closed Enselic closed 2 years ago

Enselic commented 2 years ago

This makes it easy for me to try out e.g. https://github.com/rust-lang/rust/pull/99787 by temporarily doing the following change in the script and then run it:

index 5437494..ba0d8c6 100755
--- a/update.sh
+++ b/update.sh
@@ -4,9 +4,9 @@ pyjq() {
     python3 -c "import json, sys; print(json.load(sys.stdin)${1})"
 }

-user="rust-lang"
+user="aDotInTheVoid"
 repo="rust"
-branch="master"
+branch="rdj-dyn"

 curl -# https://raw.githubusercontent.com/${user}/${repo}/${branch}/src/rustdoc-json-types/lib.rs | sed 's/rustc_data_structures::fx::/std::collections::/g' | sed 's/FxHashMap/HashMap/g' > src/lib.rs

IMHO it would be overkill (and more complicated to use) if we made these changeable by script args ($2 $3 $4) instead, so I prefer this.

Enselic commented 2 years ago

@aDotInTheVoid Any chance you could take a look at this please? I used it again for https://github.com/rust-lang/rust/pull/100762 and find it very useful.

The diff might look compilicated, but it's very simple actually. I just extract hardcoded strings into variables.

Let me know if you have any concerns and we'll sort them out somehow!

aDotInTheVoid commented 2 years ago

No concerns, just hadn't gotten around to looking over it, and it seemed non-urgent.