Fix cli for structopt 0.3.7 and pin to that version (#4509)

* Fix cli for structopt 0.3.7 and pin to that version

This is just some hotfix to make everything compile. In the future it
will require another pr to not depend on internals of StructOpt, but
that will probably also require some additions to StructOpt itself. To
not break the code again with another StructOpt, this also pins the
StructOpt version.

* Fix benches

* Fix for fix
This commit is contained in:
Bastian Köcher
2019-12-28 22:52:18 +01:00
committed by GitHub
parent 9876d3dd09
commit 56355879be
10 changed files with 68 additions and 85 deletions
-22
View File
@@ -14,30 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
use structopt::{StructOpt, clap::App};
use crate::params::SharedParams;
/// Something that can augment a clap app with further parameters.
/// `derive(StructOpt)` is implementing this function by default, so a macro `impl_augment_clap!`
/// is provided to simplify the implementation of this trait.
pub trait AugmentClap: StructOpt {
/// Augment the given clap `App` with further parameters.
fn augment_clap<'a, 'b>(app: App<'a, 'b>) -> App<'a, 'b>;
}
/// Macro for implementing the `AugmentClap` trait.
/// This requires that the given type uses `derive(StructOpt)`!
#[macro_export]
macro_rules! impl_augment_clap {
( $type:ident ) => {
impl $crate::AugmentClap for $type {
fn augment_clap<'a, 'b>(app: $crate::App<'a, 'b>) -> $crate::App<'a, 'b> {
$type::augment_clap(app)
}
}
}
}
/// Supports getting common params.
pub trait GetSharedParams {
/// Returns shared params if any.