process options from the command line and options file build the vectors fileNameVector, excludeVector, optionsVector, and fileOptionsVector
| 1732 | // process options from the command line and options file |
| 1733 | // build the vectors fileNameVector, excludeVector, optionsVector, and fileOptionsVector |
| 1734 | void ASConsole::processOptions(vector<string> &argvOptions) |
| 1735 | { |
| 1736 | string arg; |
| 1737 | bool ok = true; |
| 1738 | bool shouldParseOptionsFile = true; |
| 1739 | |
| 1740 | // get command line options |
| 1741 | for (size_t i = 0; i < argvOptions.size(); i++) |
| 1742 | { |
| 1743 | arg = argvOptions[i]; |
| 1744 | |
| 1745 | if ( isOption(arg, "-I" ) |
| 1746 | || isOption(arg, "--ascii") ) |
| 1747 | { |
| 1748 | useAscii = true; |
| 1749 | setlocale(LC_ALL, "C"); // use English decimal indicator |
| 1750 | localizer.setLanguageFromName("en"); |
| 1751 | } |
| 1752 | else if ( isOption(arg, "--options=none") ) |
| 1753 | { |
| 1754 | shouldParseOptionsFile = false; |
| 1755 | } |
| 1756 | else if ( isParamOption(arg, "--options=") ) |
| 1757 | { |
| 1758 | optionsFileName = getParam(arg, "--options="); |
| 1759 | optionsFileRequired = true; |
| 1760 | if (optionsFileName.compare("") == 0) |
| 1761 | setOptionsFileName(" "); |
| 1762 | } |
| 1763 | else if ( isOption(arg, "-h") |
| 1764 | || isOption(arg, "--help") |
| 1765 | || isOption(arg, "-?") ) |
| 1766 | { |
| 1767 | printHelp(); |
| 1768 | exit(EXIT_SUCCESS); |
| 1769 | } |
| 1770 | else if ( isOption(arg, "-V" ) |
| 1771 | || isOption(arg, "--version") ) |
| 1772 | { |
| 1773 | (*_err) << "Artistic Style Version " << g_version << endl; |
| 1774 | exit(EXIT_SUCCESS); |
| 1775 | } |
| 1776 | else if (arg[0] == '-') |
| 1777 | { |
| 1778 | optionsVector.push_back(arg); |
| 1779 | } |
| 1780 | else // file-name |
| 1781 | { |
| 1782 | standardizePath(arg); |
| 1783 | fileNameVector.push_back(arg); |
| 1784 | } |
| 1785 | } |
| 1786 | |
| 1787 | // get options file path and name |
| 1788 | if (shouldParseOptionsFile) |
| 1789 | { |
| 1790 | if (optionsFileName.compare("") == 0) |
| 1791 | { |
no test coverage detected