sunshine-protocol / sunshine

Governance + Bounty Platform
Other
43 stars 16 forks source link

generic cli #110

Closed 4meta5 closed 4 years ago

4meta5 commented 4 years ago

following sunshine-identity norms

4meta5 commented 4 years ago

Note to self, add docs for how the string needs to be input for BatchIssueShares, BatchBurnShares, and RegisterWeightedOrg

This implementation is in client/clientsrc/utils and it is used in client/cli/ which is used in the test-cli

#[derive(Clone, Debug)]
pub struct AccountShare(pub String, pub u64);
impl FromStr for AccountShare {
    type Err = Error;

    fn from_str(s: &str) -> Result<Self, Self::Err> {
        let coords: Vec<&str> = s.trim_matches(|p| p == '(' || p == ')' )
                                 .split(',')
                                 .collect();
        let acc_str = coords[0];
        let share_fromstr = coords[1].parse::<u64>().map_err(|_| Error::ParseIntError)?;
        Ok(AccountShare(acc_str.to_string(), share_fromstr))
    }
}

In hindsight, org registration through the CLI is not user friendly. I'll make an issue for using .json to register organizations because it's just bad usability to require the user to type out the members in the above format...

4meta5 commented 4 years ago

TODO

4meta5 commented 4 years ago

more TODO

4meta5 commented 4 years ago

I'll finish these TODOs and then merge. The last few things are:

This will finish up everything necessary for the demo

4meta5 commented 4 years ago

I'm just going to add a CHANGELOG and then merge.