omgnetwork / plasma-cli

Apache License 2.0
8 stars 6 forks source link

[usability] Implement a way to save commonly used features for later use #10

Open 0x234 opened 5 years ago

0x234 commented 5 years ago

Instead of writing plasma_cli --privatekey=foo --contract=bar provide the user with an option to save the contract and smart contract details to a configuration file.

iGetSchwifty commented 5 years ago

Do we have this on anyone’s radar? Is this blocked by something I’m not aware of? I could spin up a PR if this has been placed on the back burner. This ticket was created 4 months ago. Let me know, as I don’t want to step on anyone’s toes if they already have this fixed in a branch that is going to get merged in soon.

From my perspective pulling these from a .env or .config file shouldn’t be too time consuming and would give me an opportunity for a relatively small code fix

0x234 commented 5 years ago

If you want to have a go at this feel free! Add myself and Pong as the reviewers. Cheers :)

iGetSchwifty commented 5 years ago

My plan is to read in the values from the config when the program loads and then do some sort of nil check when the command gets executed by kingpin. Similar to if len(ownerBalanceAddress) == 0 { log.Error("Address is required to get balance") os.Exit(1) } Except instead of killing the program I would fall back to the default values read in from the config at the app start. However, I am a go beginner and when I run 'go get github.com/omisego/plasma-cli' in order to get the project under my GOPATH src folder, I get the error

go: github.com/omisego/plasma-cli@v0.0.3: parsing go.mod: unexpected module path "plasmacli" go: error loading module requirements

I get this error if I directly try to download and run 'go build' as well

Any help on how I can fix this?

Pongch commented 5 years ago

Which Go version are you running @iGetSchwifty ?

Pongch commented 5 years ago

I just tried to replicate this, got the same error. Seems to be a problem with bad Go.mod....To fix this, try remove Go.mod and Go.sum. Then run Go mod init again. Once you have the new Go.mod, running go install should work as expected.

Fyi, my Go version is 1.12.6

iGetSchwifty commented 5 years ago

That did the trick. I should be able to test and raise the PR in the next couple of days. Thank you very much

iGetSchwifty commented 5 years ago

PR raised. Sorry ended up getting busy and then got admitted to the hospital for an illness. This is really my first time interacting with Go so feel free to change anything in the PR as needed