Skip to content

Instantly share code, notes, and snippets.

@mharsch
Created July 1, 2021 20:35
Show Gist options
  • Select an option

  • Save mharsch/5d94853dd6785c0b0e21331875bdd232 to your computer and use it in GitHub Desktop.

Select an option

Save mharsch/5d94853dd6785c0b0e21331875bdd232 to your computer and use it in GitHub Desktop.
Task: add vector type option parsing to chia_plot for the -t and -2 options
so the user can specify a comma-separated list of paths instead of just a single path
e.g.
./chia-plot -n 4 -t /mnt/ssd1/,/mnt/ssd2 -2 /mnt/ssd3/,/mnt/ssd4/,/mnt/ssd5 <other options>
in the above example the actual paths used will be as follows:
plot -t_path -2_path
1 /mnt/ssd1 /mnt/ssd3
2 /mnt/ssd2 /mnt/ssd4
3 /mnt/ssd1 /mnt/ssd5
4 /mnt/ssd2 /mnt/ssd3
and so on
Requirements:
* the new solution must be backwards compatible (previous valid string arguments must work as before)
* the new solution must include descriptive/helpful instructions in the README file
* in cases where -d (finaldir) isn't specified, the completed file must be left on the tmpdir on which it was created
Suggestions:
* Study the option parsing library and play with option parsing by creating a hello-world.cpp file and using the library to get familiar with how it works
https://github.com/jarro2783/cxxopts
* use the 'i' counter in the num_plots for-loop to index into your list of directories to achieve the circular buffer behavior described above
e.g. tmp_dir = tmp_dir_vec[i%tmp_dir_vec.size()];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment