rust-secure-code / cargo-supply-chain

Gather author, contributor and publisher data on crates in your dependency graph.
Apache License 2.0
313 stars 18 forks source link

Diff-friendly output mode #62

Closed Shnatsel closed 3 years ago

Shnatsel commented 3 years ago

Adds a -d, --diffable flag that produces output more friendly towards tools such as diff and comm.

WIP, only 2/3 of the subcommands are converted. I could use input on the basic direction.

Shnatsel commented 3 years ago

crates subcommand before (and without --diffable flag)

The following crates will be ignored because they come from a local directory:
 - cargo-supply-chain

Using cached data. Cache age: 1 day

Dependency crates with the people and teams that can publish them to crates.io:

1. libc: team "github:rust-lang:libc", team "github:rust-lang:libs", JohnTitor, alexcrichton, gnzlbg, huonw, joshtriplett, rust-lang-owner
2. unicode-bidi: team "github:servo:cargo-publish", SimonSapin, behnam, larsbergstrom, mbrubeck, metajack
3. core-foundation: team "github:servo:cargo-publish", larsbergstrom, mbrubeck, metajack, pcwalton
...

with --diffable enabled

The following crates will be ignored because they come from a local directory:
 - cargo-supply-chain

Using cached data. Cache age: 1 day
adler: jonas-schievink
autocfg: cuviper, matklad
base64: alicemaz, marshallpierce
...

Regardless of the flag, everything other than the list of crates with owners now goes to stderr, not stdout.

Shnatsel commented 3 years ago

For publishers this is what the output redirected to file looks like (some notices still go to stderr, like cache age):

user "4lDO2": redox_syscall
user "BurntSushi": bstr, byteorder, csv, csv-core, memchr, regex, regex-automata, regex-syntax
user "Dylan-DPC": directories-next, dirs-sys-next
user "Frommi": miniz_oxide
user "GREsau": schemars, schemars_derive
user "Hoverbear": url
user "JohnTitor": libc
user "Kimundi": lazy_static
user "Lokathor": tinyvec
user "Manishearth": unicode-normalization, unicode-width, unicode-xid
user "MggMuggins": redox_users
user "RazrFalcon": pico-args
user "SimonSapin": form_urlencoded, idna, matches, percent-encoding, unicode-bidi, unicode-normalization, unicode-width, unicode-xid, url
user "Soveu": tinyvec_macros
user "Stebalien": xattr
user "alexcrichton": bitflags, bumpalo, cc, cfg-if, filetime, flate2, js-sys, libc, log, openssl-probe, proc-macro2, regex, regex-syntax, semver, tar, unicode-normalization, unicode-width, unicode-xid, wasi, wasm-bindgen, wasm-bindgen-backend, wasm-bindgen-macro, wasm-bindgen-macro-support, wasm-bindgen-shared, web-sys
user "algesten": ureq
user "alicemaz": base64
user "behnam": unicode-bidi
user "briansmith": ring, untrusted, webpki
user "ctz": rustls, rustls-native-certs, sct, webpki-roots
user "cuviper": autocfg
user "dhardy": getrandom
user "djc": indicatif
user "dtolnay": dyn-clone, itoa, proc-macro2, quote, ryu, serde, serde_derive, serde_derive_internals, serde_json, syn
user "eminence": terminal_size
user "erickt": serde, serde_json
user "fitzgen": bumpalo, js-sys, wasm-bindgen, wasm-bindgen-backend, wasm-bindgen-macro, wasm-bindgen-macro-support, wasm-bindgen-shared, web-sys
user "frewsxcv": chunked_transfer
user "gnzlbg": libc
user "huonw": bitflags, libc, log, unicode-normalization, unicode-width, unicode-xid
user "jackpot51": redox_syscall, redox_users
user "jean-airoldie": humantime-serde
user "jonas-schievink": adler
user "joshtriplett": flate2, libc
user "jsha": ureq
user "kornelski": security-framework, security-framework-sys
user "kwantam": unicode-normalization, unicode-width, unicode-xid
user "larsbergstrom": core-foundation, core-foundation-sys, unicode-bidi
user "marshallpierce": base64
user "matklad": autocfg, once_cell
user "mbrubeck": core-foundation, unicode-bidi
user "metajack": core-foundation, unicode-bidi
user "mitsuhiko": console, indicatif
user "mvdnes": spin
user "nmccarty": directories-next, dirs-sys-next
user "ogham": number_prefix
user "oli-obk": cargo_metadata
user "oyvindln": miniz_oxide
user "pcwalton": core-foundation
user "pksunkara": console
user "retep998": winapi, winapi-i686-pc-windows-gnu, winapi-x86_64-pc-windows-gnu
user "rust-lang-owner": flate2, libc
user "seanmonstar": url
user "sfackler": log, schannel, security-framework, security-framework-sys
user "srijs": crc32fast
user "steffengy": schannel
user "steveklabnik": semver, semver-parser
user "sujayakar": unicode-normalization, unicode-width, unicode-xid
user "sunfishcode": wasi
user "tailhook": humantime
user "tormol": encode_unicode
user "vorner": once_cell
user "zesterer": spin
team "github:rust-bus:maintainers": security-framework, security-framework-sys, tinyvec
team "github:rust-lang-nursery:libs": bitflags, lazy_static, log
team "github:rust-lang-nursery:log-owners": log
team "github:rust-lang-nursery:regex-owners": regex, regex-syntax
team "github:rust-lang:libc": libc
team "github:rust-lang:libs": cfg-if, libc, regex, regex-syntax
team "github:rust-random:maintainers": getrandom
team "github:rustwasm:core": js-sys, wasm-bindgen, wasm-bindgen-backend, wasm-bindgen-macro, wasm-bindgen-macro-support, wasm-bindgen-shared, web-sys
team "github:serde-rs:owners": serde, serde_derive, serde_derive_internals, serde_json
team "github:servo:cargo-publish": core-foundation, core-foundation-sys, form_urlencoded, idna, percent-encoding, unicode-bidi, url
team "github:servo:rust-url": form_urlencoded, idna, percent-encoding, url