I'm reading the code of Substrate Node Template, trying to get a deeper understanding of the implementation of it. However, I stuck when I tried to find out how the node deals with command line arguments, such as --dev.

From what I have learned from the codes, I believe that the SubstrateCli::from_iter function is responsible for parsing command line arguments, and the program crashes at the let matches = app.try_get_matches_from(iter).unwrap_or_else(|e| e.exit()); statement if I enter a incorrect cli argument(--devx, for instance). But how does the program know that --devx is incorrect while --dev is the correct one?

1 Answer 1


I think this is a built-in feature of clap instead of Substrate.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.