NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
crates.io · #932 most downloaded on crates.io
Parse command line argument by defining a struct, derive crate.
Last release 5 years ago
no release in 18 months
Release timing varies
gaps range from 2 weeks to 7 months
Most releases are documented
notes for 35 of 55 stable releases
2 versions withdrawn
withdrawn after publishing
10 years old
57 releases · first in 2017
usage display required args in usage, even if only required by others
tests remove cargo test from claptests makefile
One column per quarter.
option fix bug with option occurrence values
<!-- next-url --> [Unreleased]: https://github.com/clap-rs/clap/compare/v4.6.7...HEAD [4.6.7]: https://github.com/clap-rs/clap/compare/v4.6.6...v4.6.7 [4.6.6]: https://github.com/clap-rs/clap/compare/v4.6.5...v4.6.6 [4.6.5]: https://github.com/clap-rs/clap/compare/v4.6.4...v4.6.5 [4.6.4]: https://github.com/clap-rs/clap/compare/v4.6.3...v4.6.4 [4.6.3]: https://github.com/clap-rs/clap/compare/v4.6.2...v4.6.3 [4.6.2]: https://github.com/clap-rs/clap/compare/v4.6.1...v4.6.2 [4.6.1]: https://github.com/clap-rs/clap/compare/v4.6.0...v4.6.1 [4.6.0]: https://github.com/clap-rs/clap/compare/v4.5.61...v4.6.0 [4.5.61]: https://github.com/clap-rs/clap/compare/v4.5.60...v4.5.61 [4.5.60]: https://github.com/clap-rs/clap/compare/v4.5.59...v4.5.60 [4.5.59]: https://github.com/clap-rs/clap/compare/v4.5.58...v4.5.59 [4.5.58]: https://github.com/clap-rs/clap/compare/v4.5.57...v4.5.58 [4.5.57]: https://github.com/clap-rs/clap/compare/v4.5.56...v4.5.57 [4.5.56]: https://github.com/clap-rs/clap/compare/v4.5.55...v4.5.56 [4.5.55]: https://github.com/clap-rs/clap/compare/v4.5.54...v4.5.55 [4.5.54]: https://github.com/clap-rs/clap/compare/v4.5.53...v4.5.54 [4.5.53]: https://github.com/clap-rs/clap/compare/v4.5.52...v4.5.53 [4.5.52]: https://github.com/clap-rs/clap/compare/v4.5.51...v4.5.52 [4.5.51]: https://github.com/clap-rs/clap/compare/v4.5.50...v4.5.51 [4.5.50]: https://github.com/clap-rs/clap/compare/v4.5.49...v4.5.50 [4.5.49]: https://github.com/clap-rs/clap/compare/v4.5.48...v4.5.49 [4.5.48]: https://github.com/clap-rs/clap/compare/v4.5.47...v4.5.48 [4.5.47]: https://github.com/clap-rs/clap/compare/v4.5.46...v4.5.47 [4.5.46]: https://github.com/clap-rs/clap/compare/v4.5.45...v4.5.46 [4.5.45]: https://github.com/clap-rs/clap/compare/v4.5.44...v4.5.45 [4.5.44]: https://github.com/clap-rs/clap/compare/v4.5.43...v4.5.44 [4.5.43]: https://github.com/clap-rs/clap/compare/v4.5.42...v4.5.43 [4.5.42]: https://github.com/clap-rs/clap/compare/v4.5.41...v4.5.42 [4.5.41]: https://github.com/clap-rs/clap/compare/v4.5.40...v4.5.41 [4.5.40]: https://github.com/clap-rs/clap/compare/v4.5.39...v4.5.40 [4.5.39]: https://github.com/clap-rs/clap/compare/v4.5.38...v4.5.39 [4.5.38]: https://github.com/clap-rs/clap/compare/v4.5.37...v4.5.38 [4.5.37]: https://github.com/clap-rs/clap/compare/v4.5.36...v4.5.37 [4.5.36]: https://github.com/clap-rs/clap/compare/v4.5.35...v4.5.36 [4.5.35]: https://github.com/clap-rs/clap/compare/v4.5.34...v4.5.35 [4.5.34]: https://github.com/clap-rs/clap/compare/v4.5.33...v4.5.34 [4.5.33]: https://github.com/clap-rs/clap/compare/v4.5.32...v4.5.33 [4.5.32]: https://github.com/clap-rs/clap/compare/v4.5.31...v4.5.32 [4.5.31]: https://github.com/clap-rs/clap/compare/v4.5.30...v4.5.31 [4.5.30]: https://github.com/clap-rs/clap/compare/v4.5.29...v4.5.30 [4.5.29]: https://github.com/clap-rs/clap/compare/v4.5.28...v4.5.29 [4.5.28]: https://github.com/clap-rs/clap/compare/v4.5.27...v4.5.28 [4.5.27]: https://github.com/clap-rs/clap/compare/v4.5.26...v4.5.27 [4.5.26]: https://github.com/clap-rs/clap/compare/v4.5.25...v4.5.26 [4.5.25]: https://github.com/clap-rs/clap/compare/v4.5.24...v4.5.25 [4.5.24]: https://github.com/clap-rs/clap/compare/v4.5.23...v4.5.24 [4.5.23]: https://github.com/clap-rs/clap/compare/v4.5.22...v4.5.23 [4.5.22]: https://github.com/clap-rs/clap/compare/v4.5.21...v4.5.22 [4.5.21]: https://github.com/clap-rs/clap/compare/v4.5.20...v4.5.21 [4.5.20]: https://github.com/clap-rs/clap/compare/v4.5.19...v4.5.20 [4.5.19]: https://github.com/clap-rs/clap/compare/v4.5.18...v4.5.19 [4.5.18]: https://github.com/clap-rs/clap/compare/v4.5.17...v4.5.18 [4.5.17]: https://github.com/clap-rs/clap/compare/v4.5.16...v4.5.17 [4.5.16]: https://github.com/clap-rs/clap/compare/v4.5.15...v4.5.16 [4.5.15]: https://github.com/clap-rs/clap/compare/v4.5.14...v4.5.15 [4.5.14]: https://github.com/clap-rs/clap/compare/v4.5.13...v4.5.14 [4.5.13]: https://github.com/clap-rs/clap/compare/v4.5.12...v4.5.13 [4.5.12]: https://github.com/clap-rs/clap/compare/v4.5.11...v4.5.12 [4.5.11]: https://github.com/clap-rs/clap/compare/v4.5.10...v4.5.11 [4.5.10]: https://github.com/clap-rs/clap/compare/v4.5.9...v4.5.10 [4.5.9]: https://github.com/clap-rs/clap/compare/v4.5.8...v4.5.9 [4.5.8]: https://github.com/clap-rs/clap/compare/v4.5.7...v4.5.8 [4.5.7]: https://github.com/clap-rs/clap/compare/v4.5.6...v4.5.7 [4.5.6]: https://github.com/clap-rs/clap/compare/v4.5.5...v4.5.6 [4.5.5]: https://github.com/clap-rs/clap/compare/v4.5.4...v4.5.5 [4.5.4]: https://github.com/clap-rs/clap/compare/v4.5.3...v4.5.4 [4.5.3]: https://github.com/clap-rs/clap/compare/v4.5.2...v4.5.3 [4.5.2]: https://github.com/clap-rs/clap/compare/v4.5.1...v4.5.2 [4.5.1]: https://github.com/clap-rs/clap/compare/v4.5.0...v4.5.1 [4.5.0]: https://github.com/clap-rs/clap/compare/v4.4.18...v4.5.0 [4.4.18]: https://github.com/clap-rs/clap/compare/v4.4.17...v4.4.18 [4.4.17]: https://github.com/clap-rs/clap/compare/v4.4.16...v4.4.17 [4.4.16]: https://github.com/clap-rs/clap/compare/v4.4.15...v4.4.16 [4.4.15]: https://github.com/clap-rs/clap/compare/v4.4.14...v4.4.15 [4.4.14]: https://github.com/clap-rs/clap/compare/v4.4.13...v4.4.14 [4.4.13]: https://github.com/clap-rs/clap/compare/v4.4.12...v4.4.13 [4.4.12]: https://github.com/clap-rs/clap/compare/v4.4.11...v4.4.12 [4.4.11]: https://github.com/clap-rs/clap/compare/v4.4.10...v4.4.11 [4.4.10]: https://github.com/clap-rs/clap/compare/v4.4.9...v4.4.10 [4.4.9]: https://github.com/clap-rs/clap/compare/v4.4.8...v4.4.9 [4.4.8]: https://github.com/clap-rs/clap/compare/v4.4.7...v4.4.8 [4.4.7]: https://github.com/clap-rs/clap/compare/v4.4.6...v4.4.7 [4.4.6]: https://github.com/clap-rs/clap/compare/v4.4.5...v4.4.6 [4.4.5]: https://github.com/clap-rs/clap/compare/v4.4.4...v4.4.5 [4.4.4]: https://github.com/clap-rs/clap/compare/v4.4.3...v4.4.4 [4.4.3]: https://github.com/clap-rs/clap/compare/v4.4.2...v4.4.3 [4.4.2]: https://github.com/clap-rs/clap/compare/v4.4.1...v4.4.2 [4.4.1]: https://github.com/clap-rs/clap/compare/v4.4.0...v4.4.1 [4.4.0]: https://github.com/clap-rs/clap/compare/v4.3.24...v4.4.0 [4.3.24]: https://github.com/clap-rs/clap/compare/v4.3.23...v4.3.24 [4.3.23]: https://github.com/clap-rs/clap/compare/v4.3.22...v4.3.23 [4.3.22]: https://github.com/clap-rs/clap/compare/v4.3.21...v4.3.22 [4.3.21]: https://github.com/clap-rs/clap/compare/v4.3.20...v4.3.21 [4.3.20]: https://github.com/clap-rs/clap/compare/v4.3.19...v4.3.20 [4.3.19]: https://github.com/clap-rs/clap/compare/v4.3.18...v4.3.19 [4.3.18]: https://github.com/clap-rs/clap/compare/v4.3.17...v4.3.18 [4.3.17]: https://github.com/clap-rs/clap/compare/v4.3.16...v4.3.17 [4.3.16]: https://github.com/clap-rs/clap/compare/v4.3.15...v4.3.16 [4.3.15]: https://github.com/clap-rs/clap/compare/v4.3.14...v4.3.15 [4.3.14]: https://github.com/clap-rs/clap/compare/v4.3.13...v4.3.14 [4.3.13]: https://github.com/clap-rs/clap/compare/v4.3.12...v4.3.13 [4.3.12]: https://github.com/clap-rs/clap/compare/v4.3.11...v4.3.12 [4.3.11]: https://github.com/clap-rs/clap/compare/v4.3.10...v4.3.11 [4.3.10]: https://github.com/clap-rs/clap/compare/v4.3.9...v4.3.10 [4.3.9]: https://github.com/clap-rs/clap/compare/v4.3.8...v4.3.9 [4.3.8]: https://github.com/clap-rs/clap/compare/v4.3.7...v4.3.8 [4.3.7]: https://github.com/clap-rs/clap/compare/v4.3.6...v4.3.7 [4.3.6]: https://github.com/clap-rs/clap/compare/v4.3.5...v4.3.6 [4.3.5]: https://github.com/clap-rs/clap/compare/v4.3.4...v4.3.5 [4.3.4]: https://github.com/clap-rs/clap/compare/v4.3.3...v4.3.4 [4.3.3]: https://github.com/clap-rs/clap/compare/v4.3.2...v4.3.3 [4.3.2]: https://github.com/clap-rs/clap/compare/v4.3.1...v4.3.2 [4.3.1]: https://github.com/clap-rs/clap/compare/v4.3.0...v4.3.1 [4.3.0]: https://github.com/clap-rs/clap/compare/v4.2.7...v4.3.0 [4.2.7]: https://github.com/clap-rs/clap/compare/v4.2.6...v4.2.7 [4.2.6]: https://github.com/clap-rs/clap/compare/v4.2.5...v4.2.6 [4.2.5]: https://github.com/clap-rs/clap/compare/v4.2.4...v4.2.5 [4.2.4]: https://github.com/clap-rs/clap/compare/v4.2.3...v4.2.4 [4.2.3]: https://github.com/clap-rs/clap/compare/v4.2.2...v4.2.3 [4.2.2]: https://github.com/clap-rs/clap/compare/v4.2.1...v4.2.2 [4.2.1]: https://github.com/clap-rs/clap/compare/v4.2.0...v4.2.1 [4.2.0]: https://github.com/clap-rs/clap/compare/v4.1.14...v4.2.0 [4.1.14]: https://github.com/clap-rs/clap/compare/v4.1.13...v4.1.14 [4.1.13]: https://github.com/clap-rs/clap/compare/v4.1.12...v4.1.13 [4.1.12]: https://github.com/clap-rs/clap/compare/v4.1.11...v4.1.12 [4.1.11]: https://github.com/clap-rs/clap/compare/v4.1.10...v4.1.11 [4.1.10]: https://github.com/clap-rs/clap/compare/v4.1.9...v4.1.10 [4.1.9]: https://github.com/clap-rs/clap/compare/v4.1.8...v4.1.9 [4.1.8]: https://github.com/clap-rs/clap/compare/v4.1.7...v4.1.8 [4.1.7]: https://github.com/clap-rs/clap/compare/v4.1.6...v4.1.7 [4.1.6]: https://github.com/clap-rs/clap/compare/v4.1.5...v4.1.6 [4.1.5]: https://github.com/clap-rs/clap/compare/v4.1.4...v4.1.5 [4.1.4]: https://github.com/clap-rs/clap/compare/v4.1.3...v4.1.4 [4.1.3]: https://github.com/clap-rs/clap/compare/v4.1.2...v4.1.3 [4.1.2]: https://github.com/clap-rs/clap/compare/v4.1.1...v4.1.2 [4.1.1]: https://github.com/clap-rs/clap/compare/v4.1.0...v4.1.1 [4.1.0]: https://github.com/clap-rs/clap/compare/v4.0.32...v4.1.0 [4.0.32]: https://github.com/clap-rs/clap/compare/v4.0.31...v4.0.32 [4.0.31]: https://github.com/clap-rs/clap/compare/v4.0.30...v4.0.31 [4.0.30]: https://github.com/clap-rs/clap/compare/v4.0.29...v4.0.30 [4.0.29]: https://github.com/clap-rs/clap/compare/v4.0.28...v4.0.29 [4.0.28]: https://github.com/clap-rs/clap/compare/v4.0.27...v4.0.28 [4.0.27]: https://github.com/clap-rs/clap/compare/v4.0.26...v4.0.27 [4.0.26]: https://github.com/clap-rs/clap/compare/v4.0.25...v4.0.26 [4.0.25]: https://github.com/clap-rs/clap/compare/v4.0.24...v4.0.25 [4.0.24]: https://github.com/clap-rs/clap/compare/v4.0.23...v4.0.24 [4.0.23]: https://github.com/clap-rs/clap/compare/v4.0.22...v4.0.23 [4.0.22]: https://github.com/clap-rs/clap/compare/v4.0.21...v4.0.22 [4.0.21]: https://github.com/clap-rs/clap/compare/v4.0.20...v4.0.21 [4.0.20]: https://github.com/clap-rs/clap/compare/v4.0.19...v4.0.20 [4.0.19]: https://github.com/clap-rs/clap/compare/v4.0.18...v4.0.19 [4.0.18]: https://github.com/clap-rs/clap/compare/v4.0.17...v4.0.18 [4.0.17]: https://github.com/clap-rs/clap/compare/v4.0.16...v4.0.17 [4.0.16]: https://github.com/clap-rs/clap/compare/v4.0.15...v4.0.16 [4.0.15]: https://github.com/clap-rs/clap/compare/v4.0.14...v4.0.15 [4.0.14]: https://github.com/clap-rs/clap/compare/v4.0.13...v4.0.14 [4.0.13]: https://github.com/clap-rs/clap/compare/v4.0.12...v4.0.13 [4.0.12]: https://github.com/clap-rs/clap/compare/v4.0.11...v4.0.12 [4.0.11]: https://github.com/clap-rs/clap/compare/v4.0.10...v4.0.11 [4.0.10]: https://github.com/clap-rs/clap/compare/v4.0.9...v4.0.10 [4.0.9]: https://github.com/clap-rs/clap/compare/v4.0.8...v4.0.9 [4.0.8]: https://github.com/clap-rs/clap/compare/v4.0.7...v4.0.8 [4.0.7]: https://github.com/clap-rs/clap/compare/v4.0.6...v4.0.7 [4.0.6]: https://github.com/clap-rs/clap/compare/v4.0.5...v4.0.6 [4.0.5]: https://github.com/clap-rs/clap/compare/v4.0.4...v4.0.5 [4.0.4]: https://github.com/clap-rs/clap/compare/v4.0.3...v4.0.4 [4.0.3]: https://github.com/clap-rs/clap/compare/v4.0.2...v4.0.3 [4.0.2]: https://github.com/clap-rs/clap/compare/v4.0.1...v4.0.2 [4.0.1]: https://github.com/clap-rs/clap/compare/v4.0.0...v4.0.1 [4.0.0]: https://github.com/clap-rs/clap/compare/v3.2.18...v4.0.0 [3.2.18]: https://github.com/clap-rs/clap/compare/v3.2.17...v3.2.18 [3.2.17]: https://github.com/clap-rs/clap/compare/v3.2.16...v3.2.17 [3.2.16]: https://github.com/clap-rs/clap/compare/v3.2.15...v3.2.16 [3.2.15]: https://github.com/clap-rs/clap/compare/v3.2.14...v3.2.15 [3.2.14]: https://github.com/clap-rs/clap/compare/v3.2.13...v3.2.14 [3.2.13]: https://github.com/clap-rs/clap/compare/v3.2.12...v3.2.13 [3.2.12]: https://github.com/clap-rs/clap/compare/v3.2.11...v3.2.12 [3.2.11]: https://github.com/clap-rs/clap/compare/v3.2.10...v3.2.11 [3.2.10]: https://github.com/clap-rs/clap/compare/v3.2.8...v3.2.10 [3.2.8]: https://github.com/clap-rs/clap/compare/v3.2.7...v3.2.8 [3.2.7]: https://github.com/clap-rs/clap/compare/v3.2.6...v3.2.7 [3.2.6]: https://github.com/clap-rs/clap/compare/v3.2.5...v3.2.6 [3.2.5]: https://github.com/clap-rs/clap/compare/v3.2.4...v3.2.5 [3.2.4]: https://github.com/clap-rs/clap/compare/v3.2.3...v3.2.4 [3.2.3]: https://github.com/clap-rs/clap/compare/v3.2.2...v3.2.3 [3.2.2]: https://github.com/clap-rs/clap/compare/v3.2.1...v3.2.2 [3.2.1]: https://github.com/clap-rs/clap/compare/v3.2.0...v3.2.1 [3.2.0]: https://github.com/clap-rs/clap/compare/v3.1.18...v3.2.0 [3.1.18]: https://github.com/clap-rs/clap/compare/v3.1.17...v3.1.18 [3.1.17]: https://github.com/clap-rs/clap/compare/v3.1.16...v3.1.17 [3.1.16]: https://github.com/clap-rs/clap/compare/v3.1.15...v3.1.16 [3.1.15]: https://github.com/clap-rs/clap/compare/v3.1.14...v3.1.15 [3.1.14]: https://github.com/clap-rs/clap/compare/v3.1.13...v3.1.14 [3.1.13]: https://github.com/clap-rs/clap/compare/v3.1.12...v3.1.13 [3.1.12]: https://github.com/clap-rs/clap/compare/v3.1.11...v3.1.12 [3.1.11]: https://github.com/clap-rs/clap/compare/v3.1.10...v3.1.11 [3.1.10]: https://github.com/clap-rs/clap/compare/v3.1.9...v3.1.10 [3.1.9]: https://github.com/clap-rs/clap/compare/v3.1.8...v3.1.9 [3.1.8]: https://github.com/clap-rs/clap/compare/v3.1.7...v3.1.8 [3.1.7]: https://github.com/clap-rs/clap/compare/v3.1.6...v3.1.7 [3.1.6]: https://github.com/clap-rs/clap/compare/v3.1.5...v3.1.6 [3.1.5]: https://github.com/clap-rs/clap/compare/v3.1.4...v3.1.5 [3.1.4]: https://github.com/clap-rs/clap/compare/v3.1.3...v3.1.4 [3.1.3]: https://github.com/clap-rs/clap/compare/v3.1.2...v3.1.3 [3.1.2]: https://github.com/clap-rs/clap/compare/v3.1.1...v3.1.2 [3.1.1]: https://github.com/clap-rs/clap/compare/v3.1.0...v3.1.1 [3.1.0]: https://github.com/clap-rs/clap/compare/v3.0.14...v3.1.0 [3.0.14]: https://github.com/clap-rs/clap/compare/v3.0.13...v3.0.14 [3.0.13]: https://github.com/clap-rs/clap/compare/v3.0.12...v3.0.13 [3.0.12]: https://github.com/clap-rs/clap/compare/v3.0.11...v3.0.12 [3.0.11]: https://github.com/clap-rs/clap/compare/v3.0.10...v3.0.11 [3.0.10]: https://github.com/clap-rs/clap/compare/v3.0.9...v3.0.10 [3.0.9]: https://github.com/clap-rs/clap/compare/v3.0.8...v3.0.9 [3.0.8]: https://github.com/clap-rs/clap/compare/v3.0.7...v3.0.8 [3.0.7]: https://github.com/clap-rs/clap/compare/v3.0.6...v3.0.7 [3.0.6]: https://github.com/clap-rs/clap/compare/v3.0.5...v3.0.6 [3.0.5]: https://github.com/clap-rs/clap/compare/v3.0.4...v3.0.5 [3.0.4]: https://github.com/clap-rs/clap/compare/v3.0.3...v3.0.4 [3.0.3]: https://github.com/clap-rs/clap/compare/v3.0.2...v3.0.3 [3.0.2]: https://github.com/clap-rs/clap/compare/v3.0.1...v3.0.2 [3.0.1]: https://github.com/clap-rs/clap/compare/v3.0.0...v3.0.1 [3.0.0]: https://github.com/clap-rs/clap/compare/v2.34.0...v3.0.0 [2.34.0]: https://github.com/clap-rs/clap/compare/v2.33.4...v2.34.0 [2.33.4]: https://github.com/clap-rs/clap/compare/v2.33.3...v2.33.4 [2.33.3]: https://github.com/clap-rs/clap/compare/v2.33.2...v2.33.3 [2.33.2]: https://github.com/clap-rs/clap/compare/v2.33.1...v2.33.2 [2.33.1]: https://github.com/clap-rs/clap/compare/v2.33.0...v2.33.1 [2.33.0]: https://github.com/clap-rs/clap/compare/v2.32.0...v2.33.0
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
This is unusually big patch release. It contains a number of bugfixes and new features, some of them may theoretically be considered breaking. We did
This is unusually big patch release. It contains a number of bugfixes and new features, some of them may theoretically be considered breaking. We did our best to avoid any problems on user's side but, if it wasn't good enough, please file an issue ASAP.
structopt used to treat ::path::to::type::Vec<T> as Vec<T>
special type. This was considered erroneous.
(same for Option<T> and bool). Now only exact Vec<T> match is a special type.
#[structopt(version = expr)] where expr is not a string literal used to get
overridden by auto generated .version() call,
incorrectly. Now it doesn't.
Fixed bug with top-level App::* calls on multiple structs, see
#289.
Positional bool args with no explicit #[structopt(parse(...))] annotation are
now prohibited. This couldn't work well anyway, see
this example
for details.
Now we've instituted strict priority between doc comments, about, help, and the like. See the documentation.
HUGE THANKS to @ssokolow for tidying up our documentation,
teaching me English and explaining why our doc used to suck. I promise I'll make the rest
of the doc up to your standards... sometime later!
Implement StructOpt for Box<impl StructOpt> so from now on you can use Box<T>
with flatten and subcommand (#304).
enum Command {
#[structopt(name = "version")]
PrintVersion,
#[structopt(name = "second")]
DoSomething {
#[structopt(flatten)]
config: Box<DoSomethingConfig>,
},
#[structopt(name = "first")]
DoSomethingElse {
#[structopt(flatten)]
config: Box<DoSomethingElseConfig>,
}
}
Introduced #[structopt(verbatim_doc_comment)] attribute that keeps line breaks in
doc comments, see
the documentation.
Introduced #[structopt(rename_all_env)] and #[structopt(env)] magical methods
so you can derive env var's name from field's name. See
the documentation.
Now we have nice README for our examples, check it out!
Some error messages were improved and clarified, thanks for all people involved!
try_from_str functions are now called with a &str instead of a &String
try_from_str functions are now called with a &str instead of a &String (#282)rename_all does not apply to fields that were annotated with explicit short/long/name = "..." anymore
Add from_flag custom parser to create flags from non-bool types. Fixes #185
from_flag custom parser to create flags from non-bool types.
Fixes #185structopt does not replace : with , inside "author" strings while inside <...>. Fixes #156
structopt does not replace : with , inside "author" strings while inside <...>.
Fixes #156#[structopt(skip = expr)] syntax.Fix "skip plus long doc comment" bug
Now rustc 1.36 is the minimum compiler version supported by structopt, it likely won't work with older compilers.
Now rustc 1.36 is the minimum compiler version supported by structopt,
it likely won't work with older compilers.
Once upon a time this feature had been used to enable some of improvements
in proc-macro2 crate that were available only on nightly. Nowadays this feature doesn't
mean anything so it's now removed.
-o 1 2, -o and no option provided at all by @sphynx (#180).#[derive(StructOpt)]
struct Opt {
#[structopt(long)]
fruit: Option<Vec<String>>,
}
fn main() {
assert_eq!(Opt::from_args(&["test"]), None);
assert_eq!(Opt::from_args(&["test", "--fruit"]), Some(vec![]));
assert_eq!(Opt::from_args(&["test", "--fruit=apple orange"]), Some(vec!["apple", "orange"]));
}
If you need to fall back to the old behavior you can use a type alias:
type Something = Vec<String>;
#[derive(StructOpt)]
struct Opt {
#[structopt(long)]
fruit: Option<Something>,
}
structopt 0.3 uses field renaming to deduce a name for long options and subcommands.
#[derive(StructOpt)]
struct Opt {
#[structopt(long)]
http_addr: String, // will be renamed to `--http-addr`
#[structopt(subcommand)]
addr_type: AddrType // this adds `addr-type` subcommand
}
structopt 0.2 used to leave things "as is", not renaming anything. If you want to keep old
behavior add #[structopt(rename_all = "verbatim")] on top of a struct/enum.
version, author and about attributes behavior.Proposed by @TeXitoi (#217), implemented by @CreepySkeleton (#229).
structopt have been deducing version, author, and about properties from Cargo.toml
for a long time (more accurately, from CARGO_PKG_... environment variables).
But many users found this behavior somewhat confusing, and a hack was added to cancel out
this behavior: #[structopt(author = "")].
In structopt 0.3 this has changed.
author and about are no longer deduced by default. You should use #[structopt(author, about)]
to explicitly request structopt to deduce them.version is still deduced by default. You can use #[structopt(no_version)] to
cancel it out.#[structopt(author = "", about = "", version = "")] is no longer a valid syntax
and will trigger an error.#[structopt(version = "version", author = "author", about = "about")] syntax
stays unaffected by this changes.In structopt 0.2 you were able to use any method from clap::App and clap::Arg via
raw attribute: #[structopt(raw(method_name = "arg"))]. This syntax was kind of awkward.
#[derive(StructOpt, Debug)]
#[structopt(raw(
global_settings = "&[AppSettings::ColoredHelp, AppSettings::VersionlessSubcommands]"
))]
struct Opt {
#[structopt(short = "l", long = "level", raw(aliases = r#"&["set-level", "lvl"]"#))]
level: Vec<String>,
}
Raw attributes were removed in 0.3. Now you can use any method from App and Arg directly:
#[derive(StructOpt)]
#[structopt(global_settings(&[AppSettings::ColoredHelp, AppSettings::VersionlessSubcommands]))]
struct Opt {
#[structopt(short = "l", long = "level", aliases(&["set-level", "lvl"]))]
level: Vec<String>,
}
Proposed by @Morganamilo in (#174) implemented by @sphynx in (#213).
Sometimes you want to include some fields in your StructOpt struct that are not options
and clap should know nothing about them. In structopt 0.3 it's possible via the
#[structopt(skip)] attribute. The field in question will be assigned with Default::default()
value.
#[derive(StructOpt)]
struct Opt {
#[structopt(short, long)]
speed: f32,
car: String,
// this field should not generate any arguments
#[structopt(skip)]
meta: Vec<u64>
}
paw by @gameldar (#187)Now (almost) every error message points to the location it originates from:
error: default_value is meaningless for bool
--> $DIR/bool_default_value.rs:14:24
|
14 | #[structopt(short, default_value = true)]
| ^^^^^^^^^^^^^
Nothing published for this version
Nothing published for this version
Sometimes you want to represent an optional option that optionally takes an argument, i.e [--opt[=value]]. This is represented by Option >
cmd [--opt[=value]] by @sphynx (#188)Sometimes you want to represent an optional option that optionally takes an argument,
i.e [--opt[=value]]. This is represented by Option<Option<T>>
#[derive(StructOpt)]
struct Opt {
#[structopt(long)]
fruit: Option<Option<String>>,
}
fn main() {
assert_eq!(Opt::from_args(&["test"]), None);
assert_eq!(Opt::from_args(&["test", "--fruit"]), Some(None));
assert_eq!(Opt::from_args(&["test", "--fruit=apple"]), Some("apple"));
}
* Fix #168 by @TeXitoi
Introduce smarter parsing of doc comments by @0ndorio
Automatic naming of fields and subcommands by @0ndorio
Fix minimal clap version by @TeXitoi
Upgrade syn to 0.15 by @konstin
1.21.0 is the minimum required rustc version by @TeXitoi
Fix a bug when using flatten by @fbenkstein
flatten by
@fbenksteinAdd StructOpt::from_iter_safe(), which returns an Error instead of killing the program when it fails to parse, or parses one of the short-circuiting f
StructOpt::from_iter_safe(), which returns an Error instead of
killing the program when it fails to parse, or parses one of the
short-circuiting flags. (#98
by @quodlibetor)clap features independently by
@KerollmopsAdd flattening, the insertion of options of another StructOpt struct into another (#92) by @birkenfeld
default_value or required with
Option (#88) by
@KerollmopsFail compilation when using default_value or required with bool (#80) by @TeXitoi
Work around breakage when proc-macro2's nightly feature is enabled. (#77 and proc-macro2#67) by @fitzgen
proc-macro2's nightly feature is enabled. (#77 and proc-macro2#67) by @fitzgenAn empty line in a doc comment will result in a double linefeed in the generated about/help call by @TeXitoi
* Fix #66 by @TeXitoi
Fix a bug around enum tuple and the about message in the global help by @TeXitoi
You should have nothing to do here. This breaking change may highlight some misuse that can be bugs.
u64 by @SergioBenitezIf you are using a u64 in your struct to get the number of occurrence of a flag, you should now add parse(from_occurrences) on the flag.
For example
#[structopt(short = "v", long = "verbose")]
verbose: u64,
must be changed by
#[structopt(short = "v", long = "verbose", parse(from_occurrences))]
verbose: u64,
This feature was surprising as shown in #30. Using the parse feature seems much more natural.
Structopt::from_clap to take its argument by reference by @TeXitoiThere was no reason to take the argument by value. Most of the StructOpt users will not be impacted by this change. If you are using StructOpt::from_clap, just add a & before the argument.
StructOpt was quite fuzzy in its attribute parsing: it was only searching for interesting things, e. g. something like #[structopt(foo(bar))] was accepted but not used. It now fails the compilation.
You should have nothing to do here. This breaking change may highlight some misuse that can be bugs.
In future versions, if there is cases that are not highlighted, they will be considerated as bugs, not breaking changes.
raw() wrapping instead of _raw suffixing by @TeXitoiThe syntax of raw attributes is changed to improve the syntax.
You have to change foo_raw = "bar", baz_raw = "foo" by raw(foo = "bar", baz = "foo") or raw(foo = "bar"), raw(baz = "foo").
parse(from_occurrences) parser by @SergioBenitezStructOpt::from_iter method by @KerollmopsImprove documentation by @TeXitoi
Fix a bug with optional subsubcommand and Enum by @TeXitoi
Implement custom string parser from either &str or &OsStr by @kennytm
&str or &OsStr by @kennytm* Improve doc by @TeXitoi
Fix bugs #24 and #25 by @TeXitoi
Better formatting of multiple authors by @killercup
Subcommand support by @williamyaoh
Using doc comment to populate help by @killercup
First version with flags, arguments and options support by @TeXitoi
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →