Commit bd98ae97 authored by Filipe Marques's avatar Filipe Marques

Adding version option in command line and necessary member functions to show...

Adding version option in command line and necessary member functions to show the license version copyright and add minor tweaks to license notice in source files
parent 4ecef754
/*
* This file is part of the mhwd - Manjaro Hardware Detection project
*
* mhwd - Manjaro Hardware Detection
* Roland Singer <roland@manjaro.org>
* Łukasz Matysiak <december0123@gmail.com>
* Filipe Marques <eagle.software3@gmail.com>
*
* Copyright (C) 2007 Free Software Foundation, Inc.
*
......
/*
* This file is part of the mhwd - Manjaro Hardware Detection project
*
* mhwd - Manjaro Hardware Detection
* Roland Singer <roland@manjaro.org>
* Łukasz Matysiak <december0123@gmail.com>
* Filipe Marques <eagle.software3@gmail.com>
*
* Copyright (C) 2007 Free Software Foundation, Inc.
*
......
/*
* This file is part of the mhwd - Manjaro Hardware Detection project
*
* mhwd - Manjaro Hardware Detection
* Roland Singer <roland@manjaro.org>
* Łukasz Matysiak <december0123@gmail.com>
* Filipe Marques <eagle.software3@gmail.com>
*
* Copyright (C) 2007 Free Software Foundation, Inc.
*
......
/*
* This file is part of the mhwd - Manjaro Hardware Detection project
*
* mhwd - Manjaro Hardware Detection
* Roland Singer <roland@manjaro.org>
* Łukasz Matysiak <december0123@gmail.com>
* Filipe Marques <eagle.software3@gmail.com>
*
* Copyright (C) 2007 Free Software Foundation, Inc.
*
......
/*
* This file is part of the mhwd - Manjaro Hardware Detection project
*
* mhwd - Manjaro Hardware Detection
* Roland Singer <roland@manjaro.org>
* Łukasz Matysiak <december0123@gmail.com>
* Filipe Marques <eagle.software3@gmail.com>
*
* Copyright (C) 2007 Free Software Foundation, Inc.
*
......
/*
* This file is part of the mhwd - Manjaro Hardware Detection project
*
* mhwd - Manjaro Hardware Detection
* Roland Singer <roland@manjaro.org>
* Łukasz Matysiak <december0123@gmail.com>
* Filipe Marques <eagle.software3@gmail.com>
*
* Copyright (C) 2007 Free Software Foundation, Inc.
*
......
/*
* This file is part of the mhwd - Manjaro Hardware Detection project
*
* mhwd - Manjaro Hardware Detection
* Roland Singer <roland@manjaro.org>
* Łukasz Matysiak <december0123@gmail.com>
* Filipe Marques <eagle.software3@gmail.com>
*
* Copyright (C) 2007 Free Software Foundation, Inc.
*
......
/*
* This file is part of the mhwd - Manjaro Hardware Detection project
*
* mhwd - Manjaro Hardware Detection
* Roland Singer <roland@manjaro.org>
* Łukasz Matysiak <december0123@gmail.com>
* Filipe Marques <eagle.software3@gmail.com>
*
* Copyright (C) 2007 Free Software Foundation, Inc.
*
......@@ -715,6 +718,12 @@ bool Mhwd::runScript(std::shared_ptr<Config> config, MHWD::TRANSACTIONTYPE opera
}
}
void Mhwd::set_version_mhwd(std::string version_of_software, std::string year_copyright)
{
version_ = version_of_software;
year_ = year_copyright;
}
void Mhwd::tryToParseCmdLineOptions(int argc, char* argv[], bool& autoConfigureNonFreeDriver,
std::string& operationType, std::string& autoConfigureClassID)
{
......@@ -729,6 +738,10 @@ void Mhwd::tryToParseCmdLineOptions(int argc, char* argv[], bool& autoConfigureN
{
printer_.printHelp();
}
else if (("-v" == option) || ("--version" == option))
{
printer_.printVersion(version_, year_);
}
else if (("-f" == option) || ("--force" == option))
{
arguments_.FORCE = true;
......
/*
* This file is part of the mhwd - Manjaro Hardware Detection project
*
* mhwd - Manjaro Hardware Detection
* Roland Singer <roland@manjaro.org>
* Łukasz Matysiak <december0123@gmail.com>
* Filipe Marques <eagle.software3@gmail.com>
*
* Copyright (C) 2007 Free Software Foundation, Inc.
*
......@@ -47,6 +50,7 @@ class Mhwd
public:
Mhwd();
~Mhwd() = default;
void set_version_mhwd(std::string version_of_software, std::string year_copyright);
int launch(int argc, char *argv[]);
private:
......@@ -70,6 +74,8 @@ private:
Printer printer_;
std::vector<std::string> configs_;
std::string version_, year_;
bool performTransaction(std::shared_ptr<Config> config, MHWD::TRANSACTIONTYPE type);
bool isUserRoot() const;
std::string checkEnvironment();
......
/*
* This file is part of the mhwd - Manjaro Hardware Detection project
*
* mhwd - Manjaro Hardware Detection
* Roland Singer <roland@manjaro.org>
* Łukasz Matysiak <december0123@gmail.com>
* Filipe Marques <eagle.software3@gmail.com>
*
* Copyright (C) 2007 Free Software Foundation, Inc.
*
......@@ -81,6 +84,7 @@ void Printer::printHelp() const
<< " --pci\t\t\t\t\tlist only pci devices and driver configs\n"
<< " --usb\t\t\t\t\tlist only usb devices and driver configs\n"
<< " -h/--help\t\t\t\tshow help\n"
<< " -v/--version\t\t\t\tshow version of mhwd\n"
<< " -f/--force\t\t\t\tforce reinstallation\n"
<< " -d/--detail\t\t\t\tshow detailed info for -l/-li/-lh\n"
<< " -l/--list\t\t\t\tlist available configs for devices\n"
......@@ -96,6 +100,16 @@ void Printer::printHelp() const
<< " --pmroot <path>\t\t\tset package manager root\n" << std::endl;
}
void Printer::printVersion(std::string version_mhwd, std::string year_copy) const
{
std::cout << "Manjaro Hardware Detection version "<< version_mhwd <<"\n\n"
<< "Copyright (C) "<< year_copy <<" Manjaro Linux Developers\n"
<< "This is free software licensed under GNU GPL v.3\n"
<< "There is NO warranty; not even for MERCHANTABILITY or \n"
<< "FITNESS FOR A PARTICULAR PURPOSE.\n"
<< std::endl;
}
void Printer::listDevices(const std::vector<std::shared_ptr<Device>>& devices, std::string type) const
{
if (devices.empty())
......
/*
* This file is part of the mhwd - Manjaro Hardware Detection project
*
* mhwd - Manjaro Hardware Detection
* Roland Singer <roland@manjaro.org>
* Łukasz Matysiak <december0123@gmail.com>
* Filipe Marques <eagle.software3@gmail.com>
*
* Copyright (C) 2007 Free Software Foundation, Inc.
*
......@@ -37,7 +40,8 @@ public:
void printWarning(std::string warningMsg) const;
void printMessage(MHWD::MESSAGETYPE type, std::string str) const;
void printHelp() const;
void listDevices(const std::vector<std::shared_ptr<Device>>& devices, std::string typeOfDevice) const;
void printVersion(std::string version_mhwd, std::string year_copy) const;
void listDevices(const std::vector<std::shared_ptr<Device>>& devices, std::string typeOfDevice) const;
void listConfigs(const std::vector<std::shared_ptr<Config>>& configs,
std::string header) const;
void printAvailableConfigsInDetail(const std::string& deviceType,
......
/*
* This file is part of the mhwd - Manjaro Hardware Detection project
*
* mhwd - Manjaro Hardware Detection
* Roland Singer <roland@manjaro.org>
* Łukasz Matysiak <december0123@gmail.com>
* Filipe Marques <eagle.software3@gmail.com>
*
* Copyright (C) 2007 Free Software Foundation, Inc.
*
......
/*
* This file is part of the mhwd - Manjaro Hardware Detection project
*
* mhwd - Manjaro Hardware Detection
* Roland Singer <roland@manjaro.org>
* Łukasz Matysiak <december0123@gmail.com>
* Filipe Marques <eagle.software3@gmail.com>
*
* Copyright (C) 2007 Free Software Foundation, Inc.
*
......
/*
* This file is part of the mhwd - Manjaro Hardware Detection project
*
* mhwd - Manjaro Hardware Detection
* Roland Singer <roland@manjaro.org>
* Łukasz Matysiak <december0123@gmail.com>
* Filipe Marques <eagle.software3@gmail.com>
*
* Copyright (C) 2007 Free Software Foundation, Inc.
*
......@@ -28,6 +31,7 @@ int main(int argc, char *argv[])
try
{
Mhwd mhwd;
mhwd.set_version_mhwd("0.5.1","2012 2013 2014 2015");
return mhwd.launch(argc, argv);
}
catch(...)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment