juk3n/fluffypublic Fork
⑂ 657bc97
Commits
⬇ Clone ▾
git clone https://git.rickub.com/juk3n/fluffy.git
git clone ssh://git@rickub.com/juk3n/fluffy.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

38 pressing tab helps in finding gamecommands (#39)Unverified

* added command for showing only game names

* added autocompletion script

* added auto completion installation description

---------

Co-authored-by: Adrian Duraj <adrian.duraj@onmail.com>
Adrian Duraj committed 2025-06-01T17:16:41+02:00 Browse files
657bc97 parent: 9e2b7d4
modified README.md +11 -0
@@ -31,5 +31,16 @@ user:~/some/path$ fluffy rm game_name
3131 ## Installation
3232
3333 - Move fluffy to the target folder (after the first run it will create an sql file)
34+- (optional) Add fluffy to PATH in .bashrc file
35+```console
36+export PATH=$PATH:/path/to/target/folder/fluffy
37+```
3438 - Downloaded file is ready to use
3539
40+### Auto-completion (optional)
41+
42+- Move fluffy-completion.bash script to target folder
43+- Add below line to .bashrc file
44+```console
45+source /path/to/target/folder/fluffy-completion.bash
46+```
@@ -31,5 +31,16 @@ user:~/some/path$ fluffy rm game_name
31 ## Installation31 ## Installation
32 32
33 - Move fluffy to the target folder (after the first run it will create an sql file)33 - Move fluffy to the target folder (after the first run it will create an sql file)
34+- (optional) Add fluffy to PATH in .bashrc file
35+```console
36+export PATH=$PATH:/path/to/target/folder/fluffy
37+```
34 - Downloaded file is ready to use38 - Downloaded file is ready to use
35 39
40+### Auto-completion (optional)
41+
42+- Move fluffy-completion.bash script to target folder
43+- Add below line to .bashrc file
44+```console
45+source /path/to/target/folder/fluffy-completion.bash
46+```
modified app/src/fluffyApplication.cpp +6 -1
@@ -13,7 +13,12 @@ auto FluffyApplication::handleCommand(
1313 ) -> void {
1414 if (command == "show") {
1515 for (auto &game : gameRepository->getGames()) {
16- std::cout << game.getName() << ": " << game.getPath() << std::endl;
16+ std::cout << game.getName() << ": " << game.getPath() << std::endl;
17+ }
18+ }
19+ else if (command == "only-games") {
20+ for (auto &game : gameRepository->getGames()) {
21+ std::cout << game.getName() << std::endl;
1722 }
1823 }
1924 else if (command == "rm") {
@@ -13,7 +13,12 @@ auto FluffyApplication::handleCommand(
13 ) -> void {13 ) -> void {
14 if (command == "show") {14 if (command == "show") {
15 for (auto &game : gameRepository->getGames()) {15 for (auto &game : gameRepository->getGames()) {
16- std::cout << game.getName() << ": " << game.getPath() << std::endl;16+ std::cout << game.getName() << ": " << game.getPath() << std::endl;
17+ }
18+ }
19+ else if (command == "only-games") {
20+ for (auto &game : gameRepository->getGames()) {
21+ std::cout << game.getName() << std::endl;
17 }22 }
18 }23 }
19 else if (command == "rm") {24 else if (command == "rm") {
added fluffy-completion.bash +17 -0
new file mode 100644
@@ -0,0 +1,17 @@
1+_fluffy_complete() {
2+ local local cur prev opts
3+ COMREPLY=()
4+ cur="${COMP_WORDS[COMP_CWORD]}"
5+ prev="${COMP_WORDS[COMP_CWORD-1]}"
6+
7+ if [[ "$prev" == "fluffy" ]]; then
8+ local comms="play show add"
9+ COMPREPLY=( $(compgen -W "${comms}" -- "${cur}") )
10+ fi
11+
12+ if [[ "$prev" == "play" ]]; then
13+ local games=$(fluffy only-games)
14+ COMPREPLY=( $(compgen -W "${games}" -- "${cur}") )
15+ fi
16+}
17+complete -F _fluffy_complete fluffy
new file mode 100644
@@ -0,0 +1,17 @@
1+_fluffy_complete() {
2+ local local cur prev opts
3+ COMREPLY=()
4+ cur="${COMP_WORDS[COMP_CWORD]}"
5+ prev="${COMP_WORDS[COMP_CWORD-1]}"
6+
7+ if [[ "$prev" == "fluffy" ]]; then
8+ local comms="play show add"
9+ COMPREPLY=( $(compgen -W "${comms}" -- "${cur}") )
10+ fi
11+
12+ if [[ "$prev" == "play" ]]; then
13+ local games=$(fluffy only-games)
14+ COMPREPLY=( $(compgen -W "${games}" -- "${cur}") )
15+ fi
16+}
17+complete -F _fluffy_complete fluffy