shell: reduce code and add rst cmd