pmt: CLeanup unnecessary function: real-link-path
- real-link-path function is removed. - Added --real-link-path flag to real-path function for as real-link-path.
This commit is contained in:
20
USAGE.md
20
USAGE.md
@@ -158,20 +158,16 @@ Show the **absolute block device path** for each partition. General syntax:
|
|||||||
pmt real-path partition(s) [OPTIONS]
|
pmt real-path partition(s) [OPTIONS]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Options:**
|
||||||
|
- `--real-link-path` → Tells real link path.
|
||||||
|
|
||||||
**Example usages:**\
|
**Example usages:**\
|
||||||
`pmt real-path boot` - Example output: `/dev/block/sda25`
|
`pmt real-path boot` - Example output: `/dev/block/sda25`\
|
||||||
|
`pmt real-path boot --real-link-path` - Example output: `/dev/block/by-name/boot`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### 7. `real-linkpath`
|
### 7. `type`
|
||||||
Show the **symbolic link path** for each partition (e.g., `/dev/block/by-name/boot`). General syntax:
|
|
||||||
```bash
|
|
||||||
pmt real-link-path partition(s) [OPTIONS]
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### 8. `type`
|
|
||||||
Check magic numbers to determine file system or other types of partition(s) or image(s). General syntax:
|
Check magic numbers to determine file system or other types of partition(s) or image(s). General syntax:
|
||||||
```bash
|
```bash
|
||||||
pmt type partition(s) [OPTIONS]
|
pmt type partition(s) [OPTIONS]
|
||||||
@@ -188,7 +184,7 @@ pmt type partition(s) [OPTIONS]
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### 9. `reboot`
|
### 8. `reboot`
|
||||||
Reboot the device. Default reboot target is normal. If you are using it via ADB terminal, you **DO NOT** need root to use this feature. General syntax:
|
Reboot the device. Default reboot target is normal. If you are using it via ADB terminal, you **DO NOT** need root to use this feature. General syntax:
|
||||||
```bash
|
```bash
|
||||||
pmt reboot [rebootTarget] [OPTIONS]
|
pmt reboot [rebootTarget] [OPTIONS]
|
||||||
@@ -201,7 +197,7 @@ pmt reboot [rebootTarget] [OPTIONS]
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### 10. `memtest`
|
### 9. `memtest`
|
||||||
Test your sequential (random tests is soon) read/write speed of your memory.
|
Test your sequential (random tests is soon) read/write speed of your memory.
|
||||||
```bash
|
```bash
|
||||||
pmt memtest [testPath]
|
pmt memtest [testPath]
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ set(PMT_SOURCES
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/functions/MemoryTestFunction.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/functions/MemoryTestFunction.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/functions/PartitionSizeFunction.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/functions/PartitionSizeFunction.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/functions/RealPathFunction.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/functions/RealPathFunction.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/functions/RealLinkPathFunction.cpp
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/functions/RebootFunction.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/functions/RebootFunction.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/functions/TypeFunction.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/functions/TypeFunction.cpp
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -96,8 +96,6 @@ int Main(int argc, char **argv) {
|
|||||||
AppMain);
|
AppMain);
|
||||||
FuncManager.registerFunction(std::make_unique<infoFunction>(), AppMain);
|
FuncManager.registerFunction(std::make_unique<infoFunction>(), AppMain);
|
||||||
FuncManager.registerFunction(std::make_unique<realPathFunction>(), AppMain);
|
FuncManager.registerFunction(std::make_unique<realPathFunction>(), AppMain);
|
||||||
FuncManager.registerFunction(std::make_unique<realLinkPathFunction>(),
|
|
||||||
AppMain);
|
|
||||||
FuncManager.registerFunction(std::make_unique<typeFunction>(), AppMain);
|
FuncManager.registerFunction(std::make_unique<typeFunction>(), AppMain);
|
||||||
FuncManager.registerFunction(std::make_unique<rebootFunction>(), AppMain);
|
FuncManager.registerFunction(std::make_unique<rebootFunction>(), AppMain);
|
||||||
FuncManager.registerFunction(std::make_unique<memoryTestFunction>(),
|
FuncManager.registerFunction(std::make_unique<memoryTestFunction>(),
|
||||||
|
|||||||
@@ -1,59 +0,0 @@
|
|||||||
/*
|
|
||||||
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 RLPFUN "realPathFunction"
|
|
||||||
|
|
||||||
namespace PartitionManager {
|
|
||||||
bool realLinkPathFunction::init(CLI::App &_app) {
|
|
||||||
LOGN(RLPFUN, INFO) << "Initializing variables of real link path function."
|
|
||||||
<< std::endl;
|
|
||||||
cmd = _app.add_subcommand("real-linkpath",
|
|
||||||
"Tell real link paths of partition(s)");
|
|
||||||
cmd->add_option("partition(s)", partitions, "Partition name(s)")
|
|
||||||
->required()
|
|
||||||
->delimiter(',');
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool realLinkPathFunction::run() {
|
|
||||||
for (const auto &partition : partitions) {
|
|
||||||
if (!Variables->PartMap->hasPartition(partition))
|
|
||||||
throw Error("Couldn't find partition: %s", partition.data());
|
|
||||||
|
|
||||||
if (Variables->onLogical && !Variables->PartMap->isLogical(partition)) {
|
|
||||||
if (Variables->forceProcess)
|
|
||||||
LOGN(RLPFUN, WARNING)
|
|
||||||
<< "Partition " << partition
|
|
||||||
<< " is exists but not logical. Ignoring (from --force, -f)."
|
|
||||||
<< std::endl;
|
|
||||||
else
|
|
||||||
throw Error("Used --logical (-l) flag but is not logical partition: %s",
|
|
||||||
partition.data());
|
|
||||||
}
|
|
||||||
|
|
||||||
println("%s", Variables->PartMap->getRealPathOf(partition).data());
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool realLinkPathFunction::isUsed() const { return cmd->parsed(); }
|
|
||||||
|
|
||||||
const char *realLinkPathFunction::name() const { return RLPFUN; }
|
|
||||||
} // namespace PartitionManager
|
|
||||||
@@ -27,6 +27,7 @@ bool realPathFunction::init(CLI::App &_app) {
|
|||||||
cmd->add_option("partition(s)", partitions, "Partition name(s)")
|
cmd->add_option("partition(s)", partitions, "Partition name(s)")
|
||||||
->required()
|
->required()
|
||||||
->delimiter(',');
|
->delimiter(',');
|
||||||
|
cmd->add_flag("--real-link-path", realLinkPath, "Print real link path(s)")->default_val(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,6 +47,9 @@ bool realPathFunction::run() {
|
|||||||
partition.data());
|
partition.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (realLinkPath)
|
||||||
|
println("%s", Variables->PartMap->getRealLinkPathOf(partition).data());
|
||||||
|
else
|
||||||
println("%s", Variables->PartMap->getRealPathOf(partition).data());
|
println("%s", Variables->PartMap->getRealPathOf(partition).data());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -117,20 +117,7 @@ public:
|
|||||||
class realPathFunction final : public FunctionBase {
|
class realPathFunction final : public FunctionBase {
|
||||||
private:
|
private:
|
||||||
std::vector<std::string> partitions;
|
std::vector<std::string> partitions;
|
||||||
|
bool realLinkPath = false;
|
||||||
public:
|
|
||||||
CLI::App *cmd = nullptr;
|
|
||||||
|
|
||||||
bool init(CLI::App &_app) override;
|
|
||||||
bool run() override;
|
|
||||||
|
|
||||||
[[nodiscard]] bool isUsed() const override;
|
|
||||||
[[nodiscard]] const char *name() const override;
|
|
||||||
};
|
|
||||||
|
|
||||||
class realLinkPathFunction final : public FunctionBase {
|
|
||||||
private:
|
|
||||||
std::vector<std::string> partitions;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CLI::App *cmd = nullptr;
|
CLI::App *cmd = nullptr;
|
||||||
|
|||||||
Reference in New Issue
Block a user