cli: extract ParseResult() and ParseError()
Summary:
and make callable higher up with (nRet == 0) check.
This is a backport of core#19133 [5/10]
https://github.com/bitcoin/bitcoin/pull/19133/commits/ff41a3690066081772b172f3c31a63f5fe6ea7ed
Depends on D9944
Test Plan: ninja all check-all
Reviewers: #bitcoin_abc, majcosta
Reviewed By: #bitcoin_abc, majcosta
Differential Revision: https://reviews.bitcoinabc.org/D9945