Initial commit

This commit is contained in:
2024-04-24 19:49:03 +02:00
commit 9ed8f02013
4 changed files with 96 additions and 0 deletions

28
io/cliargs.go Normal file
View File

@@ -0,0 +1,28 @@
package io
import (
"errors"
"math/big"
"os"
)
type Cliargs struct {
value *big.Int
}
func (arg *Cliargs) Parse() error {
args := os.Args[1:]
if len(args) != 1 {
return errors.New("only expected 1 arg")
}
num, success := new(big.Int).SetString(args[0], 10)
if !success {
return errors.New("argument is not an integer")
}
arg.value = num
return nil
}
func (arg *Cliargs) GetNumber() *big.Int {
return arg.value
}