pmt: start working on 1.3.0
- Add log cleaner function. - Introduce function flag structure. - Some improvements.
This commit is contained in:
41
src/functions/CleanLogFunction.cpp
Normal file
41
src/functions/CleanLogFunction.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
Copyright 2025 Yağız Zengin
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#include "functions.hpp"
|
||||
#include <PartitionManager/PartitionManager.hpp>
|
||||
|
||||
#define CFUN "cleanLogFunction"
|
||||
#define FUNCTION_CLASS cleanLogFunction
|
||||
|
||||
namespace PartitionManager {
|
||||
INIT {
|
||||
LOGN(CFUN, INFO) << "Initializing variables of clean log function." << std::endl;
|
||||
flags = {FunctionFlags::NO_MAP_CHECK, FunctionFlags::NO_SU};
|
||||
cmd = _app.add_subcommand("clean-logs", "Clean PMT logs.");
|
||||
return true;
|
||||
}
|
||||
|
||||
RUN {
|
||||
LOGN(CFUN, INFO) << "Removing log file: " << VARS.logFile << std::endl;
|
||||
Helper::LoggingProperties::setLoggingState(YES); // eraseEntry writes log!
|
||||
return Helper::eraseEntry(VARS.logFile);
|
||||
}
|
||||
|
||||
IS_USED_COMMON_BODY
|
||||
|
||||
NAME { return CFUN; }
|
||||
|
||||
} // namespace PartitionManager
|
||||
@@ -31,6 +31,7 @@ namespace PartitionManager {
|
||||
INIT {
|
||||
LOGN(MTFUN, INFO) << "Initializing variables of memory test function."
|
||||
<< std::endl;
|
||||
flags = {FunctionFlags::NO_MAP_CHECK, FunctionFlags::ADB_SUFFICIENT};
|
||||
cmd = _app.add_subcommand("memtest", "Test your write/read speed of device.");
|
||||
cmd->add_option("testDirectory", testPath, "Path to test directory")
|
||||
->default_val("/data/local/tmp")
|
||||
|
||||
@@ -23,6 +23,7 @@ Copyright 2025 Yağız Zengin
|
||||
namespace PartitionManager {
|
||||
INIT {
|
||||
LOGN(RFUN, INFO) << "Initializing variables of reboot function." << std::endl;
|
||||
flags = {FunctionFlags::NO_MAP_CHECK, FunctionFlags::ADB_SUFFICIENT};
|
||||
cmd = _app.add_subcommand("reboot", "Reboots device");
|
||||
cmd->add_option("rebootTarget", rebootTarget,
|
||||
"Reboot target (default: normal)");
|
||||
|
||||
@@ -142,6 +142,11 @@ public:
|
||||
COMMON_FUNCTION_BODY();
|
||||
};
|
||||
|
||||
class cleanLogFunction final : public FunctionBase {
|
||||
public:
|
||||
COMMON_FUNCTION_BODY();
|
||||
};
|
||||
|
||||
} // namespace PartitionManager
|
||||
|
||||
#endif // #ifndef FUNCTIONS_HPP
|
||||
|
||||
Reference in New Issue
Block a user