make commands functions and allow define a common command api