-
-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consolidate tools into a single command-line interface #753
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
226243e
Start a consolidated CLI tool with a few one of the importer crate's …
dabreegster f4ecc8c
Folding more tools into the CLI tool. #745
dabreegster b12e0c5
The CLI consumes even more. #745
dabreegster 50428cf
Add a few more tools to the CLI, introducing tokio and making
dabreegster 47b4c35
Make the importer itself a library, called from the CLI tool. #745
dabreegster 2b8df09
Fix up references to the CLI tools in shell scripts and code. #745
dabreegster b4f9a7f
Delete 3 old scripts used to mass-import maps. #745 [rebuild]
dabreegster File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
members = [ | ||
"abstio", | ||
"abstutil", | ||
"cli", | ||
"collisions", | ||
"convert_osm", | ||
"fifteen_min", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[package] | ||
name = "cli" | ||
version = "0.1.0" | ||
edition = "2018" | ||
|
||
[dependencies] | ||
aabb-quadtree = "0.1.0" | ||
abstio = { path = "../abstio" } | ||
abstutil = { path = "../abstutil" } | ||
anyhow = "1.0.38" | ||
csv = "1.1.4" | ||
geo = "0.18.0" | ||
geojson = { version = "0.22.0", features = ["geo-types"] } | ||
geom = { path = "../geom" } | ||
importer = { path = "../importer" } | ||
log = "0.4.14" | ||
map_model = { path = "../map_model" } | ||
osmio = "0.4.0" | ||
rand = "0.8.3" | ||
rand_xorshift = "0.3.0" | ||
serde = "1.0.123" | ||
sim = { path = "../sim" } | ||
structopt = "0.3.23" | ||
tokio = { version = "1.1.1", features = ["full"] } |
34 changes: 8 additions & 26 deletions
34
importer/src/bin/augment_scenario.rs → cli/src/augment_scenario.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use anyhow::Result; | ||
|
||
use geom::LonLat; | ||
|
||
pub fn run(path: String) -> Result<()> { | ||
let buffer = std::fs::read_to_string(path)?; | ||
for (idx, points) in LonLat::parse_geojson_polygons(buffer)? | ||
.into_iter() | ||
.enumerate() | ||
{ | ||
let path = format!("boundary{}.poly", idx); | ||
LonLat::write_osmosis_polygon(&path, &points)?; | ||
println!("Wrote {}", path); | ||
} | ||
Ok(()) | ||
} |
10 changes: 2 additions & 8 deletions
10
importer/src/bin/import_grid2demand.rs → cli/src/import_grid2demand.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 2 additions & 8 deletions
10
importer/src/bin/import_traffic.rs → cli/src/import_scenario.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed to take a file as a path, instead of read from STDIN. Much easier to use this as a library call from
one_step_import.rs
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small nit/reminder: Path/PathBuffer are nice and should probably be preferred for this kind of thing... though maybe this method has sufficient interop to make that an undesirably cascading change.