Use the following:

dsquery user -samid "username" | dsget user -memberof -expand

The -expand option will include nestled groups.