aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.cargo/resources/scripts/install_completion_powershell.ps139
-rw-r--r--.idea/runConfigurations/Build_All.xml4
-rw-r--r--.idea/runConfigurations/Build_All__Dev_.xml4
-rw-r--r--.idea/runConfigurations/Build_Bevy_Client.xml2
-rw-r--r--.idea/runConfigurations/Build_Bevy_Client__Dev_.xml2
-rw-r--r--.idea/runConfigurations/Build_Console.xml2
-rw-r--r--.idea/runConfigurations/Build_Console__Dev_.xml2
-rw-r--r--.idea/runConfigurations/Build_Core.xml2
-rw-r--r--.idea/runConfigurations/Build_Core__Dev_.xml2
-rw-r--r--.idea/runConfigurations/Export_Project.xml4
-rw-r--r--.idea/runConfigurations/Export_Project__Dev_.xml2
-rw-r--r--.idea/runConfigurations/Run_Bevy_Client.xml5
-rw-r--r--Cargo.lock10
-rw-r--r--Config_Export.toml4
-rw-r--r--LICENSE-THIRD-PARTY2
-rw-r--r--console/Cargo.toml1
-rw-r--r--console/src/bin/padc.rs18
-rw-r--r--export/dev/LICENSE-THIRD-PARTY2
-rw-r--r--export/dev/bin/padc.exebin6123008 -> 6471168 bytes
19 files changed, 86 insertions, 21 deletions
diff --git a/.cargo/resources/scripts/install_completion_powershell.ps1 b/.cargo/resources/scripts/install_completion_powershell.ps1
new file mode 100644
index 0000000..8707870
--- /dev/null
+++ b/.cargo/resources/scripts/install_completion_powershell.ps1
@@ -0,0 +1,39 @@
+$ErrorActionPreference = "Stop"
+
+try {
+ # Check if padc.exe exists in the current directory
+ if (-not (Test-Path -Path ".\..\padc.exe" -PathType Leaf)) {
+ throw "Error: padc.exe program not found in the current directory"
+ }
+
+ # Generate completion script
+ Write-Host "Generating padc.ps1 file..."
+ .\..\padc.exe generate-completion powershell | Out-File padc.ps1 -Encoding utf8 -Force
+
+ # Get target profile file path
+ $targetProfile = $PROFILE.CurrentUserAllHosts
+
+ # Ensure the profile directory exists
+ $profileDir = Split-Path $targetProfile -Parent
+ if (-not (Test-Path $profileDir)) {
+ New-Item -ItemType Directory -Path $profileDir -Force | Out-Null
+ }
+
+ # Copy the generated script to the profile file
+ Write-Host "Installing to user profile file..."
+ Copy-Item padc.ps1 $targetProfile -Force
+
+ # Clean up temporary files (optional)
+ # Remove-Item padc.ps1 -Force
+
+ Write-Host "`nComplete! Auto-completion has been successfully installed to $targetProfile" -ForegroundColor Green
+ Write-Host "Effective in new terminal sessions (restart PowerShell to use)"
+}
+catch {
+ Write-Host "`nError: $_" -ForegroundColor Red
+ exit 1
+}
+
+# Pause the script
+Write-Host "`nPress any key to continue..."
+$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") \ No newline at end of file
diff --git a/.idea/runConfigurations/Build_All.xml b/.idea/runConfigurations/Build_All.xml
index 98eb17f..51694ee 100644
--- a/.idea/runConfigurations/Build_All.xml
+++ b/.idea/runConfigurations/Build_All.xml
@@ -1,11 +1,11 @@
<component name="ProjectRunConfigurationManager">
- <configuration default="false" name="Build All" type="CargoCommandRunConfiguration" factoryName="Cargo Command" folderName="Build">
+ <configuration default="false" name="Build All" type="CargoCommandRunConfiguration" factoryName="Cargo Command" folderName="Build" activateToolWindowBeforeRun="false">
<option name="buildProfileId" value="release" />
<option name="command" value="build --workspace --quiet" />
<option name="workingDirectory" value="file://$PROJECT_DIR$" />
<envs />
<option name="emulateTerminal" value="true" />
- <option name="channel" value="STABLE" />
+ <option name="channel" value="DEFAULT" />
<option name="requiredFeatures" value="true" />
<option name="allFeatures" value="false" />
<option name="withSudo" value="false" />
diff --git a/.idea/runConfigurations/Build_All__Dev_.xml b/.idea/runConfigurations/Build_All__Dev_.xml
index 8de6421..fa6eb36 100644
--- a/.idea/runConfigurations/Build_All__Dev_.xml
+++ b/.idea/runConfigurations/Build_All__Dev_.xml
@@ -1,11 +1,11 @@
<component name="ProjectRunConfigurationManager">
- <configuration default="false" name="Build All (Dev)" type="CargoCommandRunConfiguration" factoryName="Cargo Command" folderName="Build (Dev)">
+ <configuration default="false" name="Build All (Dev)" type="CargoCommandRunConfiguration" factoryName="Cargo Command" folderName="Build (Dev)" activateToolWindowBeforeRun="false">
<option name="buildProfileId" value="dev" />
<option name="command" value="build --workspace" />
<option name="workingDirectory" value="file://$PROJECT_DIR$" />
<envs />
<option name="emulateTerminal" value="true" />
- <option name="channel" value="STABLE" />
+ <option name="channel" value="DEFAULT" />
<option name="requiredFeatures" value="true" />
<option name="allFeatures" value="false" />
<option name="withSudo" value="false" />
diff --git a/.idea/runConfigurations/Build_Bevy_Client.xml b/.idea/runConfigurations/Build_Bevy_Client.xml
index c1356e4..7754cd7 100644
--- a/.idea/runConfigurations/Build_Bevy_Client.xml
+++ b/.idea/runConfigurations/Build_Bevy_Client.xml
@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
- <configuration default="false" name="Build Bevy Client" type="CargoCommandRunConfiguration" factoryName="Cargo Command" folderName="Build">
+ <configuration default="false" name="Build Bevy Client" type="CargoCommandRunConfiguration" factoryName="Cargo Command" folderName="Build" activateToolWindowBeforeRun="false">
<option name="command" value="build --manifest-path ./client/Cargo.toml --release --quiet" />
<option name="workingDirectory" value="file://$PROJECT_DIR$" />
<envs />
diff --git a/.idea/runConfigurations/Build_Bevy_Client__Dev_.xml b/.idea/runConfigurations/Build_Bevy_Client__Dev_.xml
index be905ea..580a378 100644
--- a/.idea/runConfigurations/Build_Bevy_Client__Dev_.xml
+++ b/.idea/runConfigurations/Build_Bevy_Client__Dev_.xml
@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
- <configuration default="false" name="Build Bevy Client (Dev)" type="CargoCommandRunConfiguration" factoryName="Cargo Command" folderName="Build (Dev)">
+ <configuration default="false" name="Build Bevy Client (Dev)" type="CargoCommandRunConfiguration" factoryName="Cargo Command" folderName="Build (Dev)" activateToolWindowBeforeRun="false">
<option name="command" value="build --manifest-path ./client/Cargo.toml" />
<option name="workingDirectory" value="file://$PROJECT_DIR$" />
<envs />
diff --git a/.idea/runConfigurations/Build_Console.xml b/.idea/runConfigurations/Build_Console.xml
index a22eed3..f618a18 100644
--- a/.idea/runConfigurations/Build_Console.xml
+++ b/.idea/runConfigurations/Build_Console.xml
@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
- <configuration default="false" name="Build Console" type="CargoCommandRunConfiguration" factoryName="Cargo Command" folderName="Build">
+ <configuration default="false" name="Build Console" type="CargoCommandRunConfiguration" factoryName="Cargo Command" folderName="Build" activateToolWindowBeforeRun="false">
<option name="command" value="build --manifest-path ./console/Cargo.toml --release --quiet" />
<option name="workingDirectory" value="file://$PROJECT_DIR$" />
<envs />
diff --git a/.idea/runConfigurations/Build_Console__Dev_.xml b/.idea/runConfigurations/Build_Console__Dev_.xml
index 866a89c..50cc9a7 100644
--- a/.idea/runConfigurations/Build_Console__Dev_.xml
+++ b/.idea/runConfigurations/Build_Console__Dev_.xml
@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
- <configuration default="false" name="Build Console (Dev)" type="CargoCommandRunConfiguration" factoryName="Cargo Command" folderName="Build (Dev)">
+ <configuration default="false" name="Build Console (Dev)" type="CargoCommandRunConfiguration" factoryName="Cargo Command" folderName="Build (Dev)" activateToolWindowBeforeRun="false">
<option name="command" value="build --manifest-path ./console/Cargo.toml" />
<option name="workingDirectory" value="file://$PROJECT_DIR$" />
<envs />
diff --git a/.idea/runConfigurations/Build_Core.xml b/.idea/runConfigurations/Build_Core.xml
index 952a8bd..4ac3786 100644
--- a/.idea/runConfigurations/Build_Core.xml
+++ b/.idea/runConfigurations/Build_Core.xml
@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
- <configuration default="false" name="Build Core" type="CargoCommandRunConfiguration" factoryName="Cargo Command" folderName="Build">
+ <configuration default="false" name="Build Core" type="CargoCommandRunConfiguration" factoryName="Cargo Command" folderName="Build" activateToolWindowBeforeRun="false">
<option name="command" value="build --manifest-path ./core/Cargo.toml --release --quiet" />
<option name="workingDirectory" value="file://$PROJECT_DIR$" />
<envs />
diff --git a/.idea/runConfigurations/Build_Core__Dev_.xml b/.idea/runConfigurations/Build_Core__Dev_.xml
index 52a7136..4099321 100644
--- a/.idea/runConfigurations/Build_Core__Dev_.xml
+++ b/.idea/runConfigurations/Build_Core__Dev_.xml
@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
- <configuration default="false" name="Build Core (Dev)" type="CargoCommandRunConfiguration" factoryName="Cargo Command" folderName="Build (Dev)">
+ <configuration default="false" name="Build Core (Dev)" type="CargoCommandRunConfiguration" factoryName="Cargo Command" folderName="Build (Dev)" activateToolWindowBeforeRun="false">
<option name="command" value="build --manifest-path ./core/Cargo.toml" />
<option name="workingDirectory" value="file://$PROJECT_DIR$" />
<envs />
diff --git a/.idea/runConfigurations/Export_Project.xml b/.idea/runConfigurations/Export_Project.xml
index 5416a16..06e1048 100644
--- a/.idea/runConfigurations/Export_Project.xml
+++ b/.idea/runConfigurations/Export_Project.xml
@@ -1,11 +1,11 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Export Project" type="CargoCommandRunConfiguration" factoryName="Cargo Command" folderName="Export">
- <option name="buildProfileId" value="dev" />
+ <option name="buildProfileId" value="release" />
<option name="command" value="run --manifest-path ./export/Cargo.toml --release --bin export_project" />
<option name="workingDirectory" value="file://$PROJECT_DIR$" />
<envs />
<option name="emulateTerminal" value="true" />
- <option name="channel" value="STABLE" />
+ <option name="channel" value="DEFAULT" />
<option name="requiredFeatures" value="true" />
<option name="allFeatures" value="false" />
<option name="withSudo" value="false" />
diff --git a/.idea/runConfigurations/Export_Project__Dev_.xml b/.idea/runConfigurations/Export_Project__Dev_.xml
index 5fe30e2..7af8fc7 100644
--- a/.idea/runConfigurations/Export_Project__Dev_.xml
+++ b/.idea/runConfigurations/Export_Project__Dev_.xml
@@ -7,7 +7,7 @@
<env name="PROJECT_VERSION" value="dev" />
</envs>
<option name="emulateTerminal" value="true" />
- <option name="channel" value="STABLE" />
+ <option name="channel" value="DEFAULT" />
<option name="requiredFeatures" value="true" />
<option name="allFeatures" value="false" />
<option name="withSudo" value="false" />
diff --git a/.idea/runConfigurations/Run_Bevy_Client.xml b/.idea/runConfigurations/Run_Bevy_Client.xml
index 5442445..3374e23 100644
--- a/.idea/runConfigurations/Run_Bevy_Client.xml
+++ b/.idea/runConfigurations/Run_Bevy_Client.xml
@@ -1,10 +1,11 @@
<component name="ProjectRunConfigurationManager">
- <configuration default="false" name="Run Bevy Client" type="CargoCommandRunConfiguration" factoryName="Cargo Command" folderName="Run">
+ <configuration default="false" name="Run Bevy Client" type="CargoCommandRunConfiguration" factoryName="Cargo Command" folderName="Run" focusToolWindowBeforeRun="true">
+ <option name="buildProfileId" value="dev" />
<option name="command" value="run --package nogamepads-client --bin nogamepads-client" />
<option name="workingDirectory" value="file://$PROJECT_DIR$" />
<envs />
<option name="emulateTerminal" value="true" />
- <option name="channel" value="STABLE" />
+ <option name="channel" value="DEFAULT" />
<option name="requiredFeatures" value="true" />
<option name="allFeatures" value="false" />
<option name="withSudo" value="false" />
diff --git a/Cargo.lock b/Cargo.lock
index 18ccb38..d1200c1 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1666,6 +1666,15 @@ dependencies = [
]
[[package]]
+name = "clap_complete"
+version = "4.5.52"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1a554639e42d0c838336fc4fbedb9e2df3ad1fa4acda149f9126b4ccfcd7900f"
+dependencies = [
+ "clap",
+]
+
+[[package]]
name = "clap_derive"
version = "4.5.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3210,6 +3219,7 @@ name = "nogamepads-console"
version = "0.1.0"
dependencies = [
"clap",
+ "clap_complete",
"crossterm",
"log",
"nogamepads",
diff --git a/Config_Export.toml b/Config_Export.toml
index 2c11b03..d1d0491 100644
--- a/Config_Export.toml
+++ b/Config_Export.toml
@@ -1,11 +1,9 @@
#./
[release.root]
license = { raw = "./", target = "./", files = ["LICENSE-LGPL-2", "LICENSE-THIRD-PARTY"] }
+powershell_complete = { raw = "./.cargo/resources/scripts/", target = "./bin/completeion", files = ["install_completion_powershell.ps1"] }
#./.cargo/shared/target/export/deps
[release.deps]
-#header = { raw = "./", target = "./bridge", files = ["nogamepads_cpp.h", "nogamepads.h"] }
-#dll = { raw = "./", target = "./bridge", files = ["nogamepads_lib_c.dll"] }
-
padc = { raw = "./", target = "./bin", files = ["padc.exe"] }
diff --git a/LICENSE-THIRD-PARTY b/LICENSE-THIRD-PARTY
index eb99fb1..47b501f 100644
--- a/LICENSE-THIRD-PARTY
+++ b/LICENSE-THIRD-PARTY
@@ -11,6 +11,7 @@ This project uses third-party components with the following licenses:
* bevy (original license: Apache-2.0 OR MIT)
* chrono (original license: Apache-2.0 OR MIT)
* clap (original license: Apache-2.0 OR MIT)
+* clap_complete (original license: Apache-2.0 OR MIT)
* clearscreen (original license: Apache-2.0 OR MIT)
* env_logger (original license: Apache-2.0 OR MIT)
* hex (original license: Apache-2.0 OR MIT)
@@ -31,6 +32,7 @@ Copyright (c) 2013-2014 The Rust Project Developers.
* tokio - Copyright (c) Tokio Contributors.
* chrono - Copyright (c) 2014, Kang Seonghoon.
* clap - Copyright (c) The clap Project Developer(s).
+* clap_complete - Copyright (c) 2015-2022 Kevin B. Knapp and Clap Contributors.
* clearscreen - Copyright (c) The clearscreen Project Developer(s).
* crossterm - Copyright (c) 2019 Timon.
* env_logger - Copyright (c) The env_logger Project Developer(s).
diff --git a/console/Cargo.toml b/console/Cargo.toml
index 57860c7..5c6a313 100644
--- a/console/Cargo.toml
+++ b/console/Cargo.toml
@@ -8,6 +8,7 @@ version.workspace = true
nogamepads = { path = "../../NoGamepads" }
nogamepads-core = { path = "../core" }
clap = { version = "4.5.38", features = ["derive"] }
+clap_complete = "4.5.52"
serde = { version = "1.0.219", features = ["derive"] }
serde_yaml = "0.9.34"
tokio = { version = "1.45.0", features = ["full"] }
diff --git a/console/src/bin/padc.rs b/console/src/bin/padc.rs
index 720cbea..3323de7 100644
--- a/console/src/bin/padc.rs
+++ b/console/src/bin/padc.rs
@@ -7,6 +7,7 @@ use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::env::current_dir;
use std::fs::File;
+use std::io;
use std::io::{BufReader, Write};
use std::net::SocketAddr;
use std::path::PathBuf;
@@ -15,6 +16,7 @@ use std::str::FromStr;
use std::sync::{Arc, Mutex};
use std::sync::atomic::Ordering::SeqCst;
use std::time::Duration;
+use clap_complete::{generate, Shell};
use log::{info, LevelFilter};
use tokio::select;
use tokio::signal::ctrl_c;
@@ -31,8 +33,8 @@ use nogamepads_core::service::tcp_network::pad_client::structs::PadClientNetwork
use nogamepads_core::service::tcp_network::pad_server::structs::PadServerNetwork;
#[derive(Parser, Debug)]
-#[command(author, version, about, long_about = None)]
-struct ConsoleCli {
+#[command(version, color = ColorChoice::Auto)]
+struct Padc {
#[command(subcommand)]
command: Commands,
}
@@ -40,6 +42,11 @@ struct ConsoleCli {
#[derive(Subcommand, Debug)]
enum Commands {
+ GenerateCompletion {
+ #[arg(value_enum)]
+ shell: Shell,
+ },
+
#[command(subcommand, about = "Manage accounts")]
Account(AccountCommands),
@@ -257,10 +264,15 @@ struct LocalControllerData {
}
fn main () {
- let cli = ConsoleCli::parse();
+ let cli = Padc::parse();
let mut data = read();
match cli.command {
+ Commands::GenerateCompletion {shell} => {
+ let mut cmd = Padc::command();
+ generate(shell, &mut cmd.clone(), "padc", &mut io::stdout());
+ }
+
Commands::Account(cmds) => {
match cmds {
AccountCommands::Add(args) => {
diff --git a/export/dev/LICENSE-THIRD-PARTY b/export/dev/LICENSE-THIRD-PARTY
index eb99fb1..47b501f 100644
--- a/export/dev/LICENSE-THIRD-PARTY
+++ b/export/dev/LICENSE-THIRD-PARTY
@@ -11,6 +11,7 @@ This project uses third-party components with the following licenses:
* bevy (original license: Apache-2.0 OR MIT)
* chrono (original license: Apache-2.0 OR MIT)
* clap (original license: Apache-2.0 OR MIT)
+* clap_complete (original license: Apache-2.0 OR MIT)
* clearscreen (original license: Apache-2.0 OR MIT)
* env_logger (original license: Apache-2.0 OR MIT)
* hex (original license: Apache-2.0 OR MIT)
@@ -31,6 +32,7 @@ Copyright (c) 2013-2014 The Rust Project Developers.
* tokio - Copyright (c) Tokio Contributors.
* chrono - Copyright (c) 2014, Kang Seonghoon.
* clap - Copyright (c) The clap Project Developer(s).
+* clap_complete - Copyright (c) 2015-2022 Kevin B. Knapp and Clap Contributors.
* clearscreen - Copyright (c) The clearscreen Project Developer(s).
* crossterm - Copyright (c) 2019 Timon.
* env_logger - Copyright (c) The env_logger Project Developer(s).
diff --git a/export/dev/bin/padc.exe b/export/dev/bin/padc.exe
index e628f49..0b55cc9 100644
--- a/export/dev/bin/padc.exe
+++ b/export/dev/bin/padc.exe
Binary files differ