Skip to content

Commit

Permalink
Fixing CLI completion and updating README (#345)
Browse files Browse the repository at this point in the history
* Fixing completion

* Updating README

* Updating README

* Updating README

* Updating README

* Updating README

* Updating README
  • Loading branch information
hpedrorodrigues authored Nov 5, 2023
1 parent 2760d13 commit 418ea4a
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 57 deletions.
85 changes: 34 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,29 @@
<p align="center">
<img src="./assets/sphynx-landscape.png" align="center" height="50%" width="50%"/>
</p>

[![Checks (Stable)][stable-checks-badge]][stable-checks-workflow]
[![Build and Push (Stable)][stable-build-badge]][stable-build-workflow]

Sphynx is a personal project including CLI, dotfiles, workspace setup scripts
among other things.

<img align="right" src="./assets/sphynx-demo.gif" width="60%" />

- [About](#about)
- [CLI](#cli)
- [Dotfiles](#dotfiles)
- [External tools](#external-tools)
- [Workspace configuration](#workspace-configuration)
- [Installation](#installation)
<p align="center">
<img alt="Logo" src="./assets/sphynx-landscape.png" width="80%">
</p>
<p align="center">
<a href="#cli">CLI</a>&nbsp;&nbsp;&nbsp;&nbsp;
<a href="#dotfiles">Dotfiles</a>&nbsp;&nbsp;&nbsp;&nbsp;
<a href="#external-tools">External Tools</a>&nbsp;&nbsp;&nbsp;&nbsp;
<a href="#workspace-configuration">Workspace Configuration</a>
</p>

## About

Sphynx has aliases, functions, CLI, workspace setup configuration,
applications' settings, docker images. Everything I use on a daily
basis and how I set up my machine.

It's divided into four main components described below.
This is a personal project containing everything I use on a daily basis and how
I set up my machine. It has aliases, functions, CLI, workspace configuration,
applications' settings, docker images, and more.

### CLI

Sphynx provides a [command-line interface][cli-folder] to handle all stuff related to
this project and to automate boring tasks using [docopt][docopt-website].
<img align="right" alt="Demo" src="./assets/sphynx-demo.gif" width="60%">

This is the core of Sphynx. The [command-line interface][cli-folder] is used to
automate boring/repetitive tasks and helps me manage the other parts of this
project.

e.g.
```bash
Expand All @@ -37,13 +32,15 @@ $ sx android device --connect
$ sx system clear-trash
```

The commands are configured using environment variables, and each command may
have its own settings. For instance, `sx kubernetes ls` uses the env var
`SX_KUBERNETES_RESOURCES` to know what resources to list.

Most commands use the [fuzzy finder][fzf] to provide a better experience with an
interactive menu + fuzzy searching, and even though it's not a mandatory
dependency it could be good installing it.
interactive menu + fuzzy searching.

If you want to give the CLI a try, you can use [Homebrew][homebrew] or
[Linuxbrew][linuxbrew] to install it.

```bash
brew install hpedrorodrigues/tools/sphynx
```

### Dotfiles

Expand Down Expand Up @@ -123,40 +120,26 @@ not all functions use the dockerfiles available in this project

### Workspace configuration

[Ansible][ansible-website] playbooks are recipes that configures and install tools
on my machine.
I use [Ansible][ansible-website] to configure my machine. It automates tedious
tasks [installing packages and applications][playbooks-folder] that I use almost
daily.

It automates tedious tasks installing packages and applications that I use
almost daily.

## Installation

If you want to give the CLI a try, you can use [Homebrew][homebrew] or
[Linuxbrew][linuxbrew] to install it.

```bash
brew install hpedrorodrigues/tools/sphynx
```

But if you want to give this whole project a try, it's recommended you fork
this repository and adjust it to your needs! Be careful!


[cli-folder]: ./modules/cli
[fzf]: https://github.com/junegunn/fzf
[homebrew]: https://brew.sh
[linuxbrew]: https://docs.brew.sh/Homebrew-on-Linux

[dotfiles-folder]: ./modules/dotfiles

[external-tools]: ./modules/dotfiles/common/scripts/external_tools.sh

[ansible-website]: https://www.ansible.com
[docopt-website]: http://docopt.org
[dotbot-website]: https://github.com/anishathalye/dotbot

[fzf]: https://github.com/junegunn/fzf
[playbooks-folder]: ./modules/playbooks

[stable-checks-badge]: https://github.com/hpedrorodrigues/sphynx/actions/workflows/stable-checks.yml/badge.svg
[stable-checks-workflow]: https://github.com/hpedrorodrigues/sphynx/actions/workflows/stable-checks.yml

[stable-build-badge]: https://github.com/hpedrorodrigues/sphynx/actions/workflows/stable-build.yml/badge.svg
[stable-build-workflow]: https://github.com/hpedrorodrigues/sphynx/actions/workflows/stable-build.yml

[homebrew]: https://brew.sh
[linuxbrew]: https://docs.brew.sh/Homebrew-on-Linux
2 changes: 1 addition & 1 deletion modules/cli/.internal/completion/_sx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# - http://zsh.sourceforge.net/Doc/Release/Completion-System.html
# - https://github.com/zsh-users/zsh/blob/master/Completion/bashcompinit

completion_dirname="${SPHYNX_DIR:-}/cli/.internal/completion"
completion_dirname="${SPHYNX_DIR:-}/modules/cli/.internal/completion"

_sx() {
local current_word="${words[-1]}"
Expand Down
2 changes: 1 addition & 1 deletion modules/cli/.internal/completion/complete
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fi
## Variables

# shellcheck disable=SC2153 # Possible Misspelling
export SPHYNX_CLI_DIR="${SPHYNX_DIR:-}/cli"
export SPHYNX_CLI_DIR="${SPHYNX_DIR:-}/modules/cli"

## Functions

Expand Down
2 changes: 1 addition & 1 deletion modules/cli/.internal/completion/sx.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# - https://debian-administration.org/article/316/An_introduction_to_bash_completion_part_1
# - https://debian-administration.org/article/317/An_introduction_to_bash_completion_part_2

completion_dirname="${SPHYNX_DIR:-}/cli/.internal/completion"
completion_dirname="${SPHYNX_DIR:-}/modules/cli/.internal/completion"

function _sx() {
COMPREPLY=()
Expand Down
5 changes: 3 additions & 2 deletions modules/dotfiles/common/.common_bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ export FZF_BIN="${HOME}/.fzf.bash"

#|> Sphynx
export SPHYNX_DIR="${HOME}/Code/Personal/sphynx"
export SPHYNX_COMPLETION_DIR="${SPHYNX_DIR}/modules/cli/.internal/completion"

if [[ "${PATH}" != *"${SPHYNX_DIR}"* ]]; then
export PATH="${PATH}:${SPHYNX_DIR}"

[ -s "${SPHYNX_DIR}/cli/.internal/completion/sx.bash" ] \
&& source "${SPHYNX_DIR}/cli/.internal/completion/sx.bash"
[ -s "${SPHYNX_COMPLETION_DIR}/sx.bash" ] \
&& source "${SPHYNX_COMPLETION_DIR}/sx.bash"
fi

#|> Startship
Expand Down
2 changes: 1 addition & 1 deletion modules/dotfiles/common/.common_zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export FZF_BIN="${HOME}/.fzf.zsh"

#|> Sphynx
export SPHYNX_DIR="${HOME}/Code/Personal/sphynx"
export SPHYNX_COMPLETION_DIR="${SPHYNX_DIR}/cli/.internal/completion"
export SPHYNX_COMPLETION_DIR="${SPHYNX_DIR}/modules/cli/.internal/completion"

if [[ "${PATH}" != *"${SPHYNX_DIR}"* ]]; then
export PATH="${PATH}:${SPHYNX_DIR}"
Expand Down

0 comments on commit 418ea4a

Please sign in to comment.