Add name option support

I had some trouble while trying to use the option `--name`. This PR is my solution to it, but I am still not sure if I used the option in the intended way or not.