To get a description of the Mac you can use the following command.
/usr/libexec/PlistBuddy -c "Print :`sysctl -n hw.model`:_LOCALIZABLE_:description" "/System/Library/PrivateFrameworks/ServerInformation.framework/Resources/English.lproj/SIMachineAttributes.plist"
Example output:
Mac mini with quad-core i7 and Intel HD Graphics 4000, introduced late 2012.
The following command can provide the Mac model information, including its "era" (example: Mac mini (Late 2012))
/usr/libexec/PlistBuddy -c "Print :`sysctl -n hw.model`:_LOCALIZABLE_:marketingModel" "/System/Library/PrivateFrameworks/ServerInformation.framework/Resources/English.lproj/SIMachineAttributes.plist"