refactoring, and test of list_target(), show_target()

Signed-off-by: Kouhei Maeda <mkouhei@palmtb.net>