Dropshell!
This commit is contained in:
parent
65b6e2b193
commit
1d8502d71a
77
README.md
77
README.md
@ -1,80 +1,3 @@
|
||||
# Dropshell
|
||||
|
||||
A system management tool for server operations, written in C++.
|
||||
|
||||
## Features
|
||||
|
||||
- System status monitoring
|
||||
- Server configuration management
|
||||
- Bash completion support
|
||||
- Command-line interface with help and version information
|
||||
|
||||
## Building from Source
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- CMake (>= 3.10)
|
||||
- Boost C++ Libraries (program_options, filesystem, system)
|
||||
- C++17 compatible compiler
|
||||
- Debian packaging tools (for creating packages)
|
||||
|
||||
### Building
|
||||
|
||||
```bash
|
||||
# Clone the repository
|
||||
git clone https://github.com/j842/dropshell.git
|
||||
cd dropshell
|
||||
|
||||
# Create build directory
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
# Configure and build
|
||||
cmake ..
|
||||
make
|
||||
```
|
||||
|
||||
### Installing
|
||||
|
||||
#### From Source
|
||||
|
||||
```bash
|
||||
# Install from source build
|
||||
sudo make install
|
||||
```
|
||||
|
||||
#### From Debian Package
|
||||
|
||||
To create a Debian package:
|
||||
|
||||
```bash
|
||||
# Install build dependencies
|
||||
sudo apt-get install devscripts debhelper cmake libboost-all-dev
|
||||
|
||||
# Build the package
|
||||
dpkg-buildpackage -us -uc
|
||||
|
||||
# Install the package
|
||||
sudo dpkg -i ../dropshell_1.0.0-1_*.deb
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
# Show help
|
||||
dropshell help
|
||||
|
||||
# Show version
|
||||
dropshell version
|
||||
|
||||
# List configured servers
|
||||
dropshell servers
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
The configuration file is located at `/etc/dropshell.conf`. You can modify this file to change default settings.
|
||||
|
||||
## License
|
||||
|
||||
MIT License - see LICENSE file for details
|
26
src/main.cpp
26
src/main.cpp
@ -14,14 +14,6 @@
|
||||
#include <iomanip>
|
||||
namespace dropshell {
|
||||
|
||||
void print_version() {
|
||||
std::cout << "dropshell version " << VERSION << std::endl;
|
||||
std::cout << "Release date: " << RELEASE_DATE << std::endl;
|
||||
std::cout << "Author: " << AUTHOR << std::endl;
|
||||
std::cout << "License: " << LICENSE << std::endl;
|
||||
}
|
||||
|
||||
|
||||
void print_help() {
|
||||
std::cout << std::endl;
|
||||
maketitle("DropShell version " + VERSION);
|
||||
@ -78,16 +70,17 @@ std::string safearg(int argc, char *argv[], int index)
|
||||
int main(int argc, char* argv[]) {
|
||||
try {
|
||||
dropshell::config *cfg = dropshell::get_global_config();
|
||||
// silently attempt to load the config file.
|
||||
cfg->load_config();
|
||||
|
||||
if (argc == 1) {
|
||||
dropshell::print_help();
|
||||
dropshell::list_servers();
|
||||
std::cout << std::endl;
|
||||
std::cout << "dropshell help - get help on using dropshell" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
std::string cmd = argv[1];
|
||||
|
||||
// silently attempt to load the config file.
|
||||
cfg->load_config();
|
||||
|
||||
// don't load old config if we're initializing
|
||||
if (cmd == "init") {
|
||||
std::string lcd;
|
||||
@ -118,16 +111,11 @@ int main(int argc, char* argv[]) {
|
||||
}
|
||||
}
|
||||
|
||||
if (cmd == "help" || cmd == "-h" || cmd == "--help") {
|
||||
if (cmd == "help" || cmd == "-h" || cmd == "--help" || cmd== "h" || cmd=="halp") {
|
||||
dropshell::print_help();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (cmd == "version" || cmd == "-V" || cmd == "--version") {
|
||||
dropshell::print_version();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// auto completion stuff.
|
||||
std::set<std::string> commands;
|
||||
std::vector<dropshell::ServerInfo> servers = dropshell::get_configured_servers();
|
||||
@ -140,7 +128,7 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
if (cmd == "autocomplete_list_commands") {
|
||||
commands.merge(std::set<std::string>{
|
||||
"help","version","init"
|
||||
"help","init"
|
||||
});
|
||||
if (cfg->is_config_set())
|
||||
commands.merge(std::set<std::string>{
|
||||
|
Loading…
x
Reference in New Issue
Block a user