add some useful func for writing cli.