Pyc

License: GPL v3 Stars Issues Crates.io Build codecov

~ Use your alphabet with your favourite shell ~
Developed by Christian Visintin
Current version: 0.1.0 (26/05/2020)



About Рус

Рус (Pronounced "Rus") is a simple CLI application, written in Rust, which allows you to interface with your favourite shell, giving you the possibility to perform commands in cyrillic and other alphabets, through command and output transliteration.

Why Рус

Well, basically I started studying russian and to become practical with the cyrillic alphabet I wanted to use it whenever was possible, even while typing on the console; but then I found out that there's not a single console which allow people which use a different alphabet to use it, so I came out with this project.

Pyc's goal

The goal of this project is to give everybody who uses an alphabet different from latin, to use the computer shell without having to switch the keyboard layout.

How it works

Basically Рус is a shell interface, which means that it reads the user input, it converts it according to the configured alphabet and then it sends the translated input to the shell which processes it; then the output is read from the shell's stdout and is (if enabled) translated back to the original alphabet and printed to user's output.

Features

Supported alphabets

Other alphabets are not planned for the moment.
Can't find yours? Contribute to the project implementing it 😀! Read More

Installation

If you're considering to install Pyc I want to thank you 💛! I hope this project can be useful for you!
If you want to contribute to this project, don't forget to check out our contribute guide. Read More

Cargo

```sh

Install pyc through cargo

cargo install pyc-shell

Install configuration

mkdir -p $HOME/.config/pyc/

Copy configuration file from repository

wget -O $HOME/.config/pyc/pyc.yml https://raw.githubusercontent.com/ChristianVisintin/Pyc/master/pyc.yml ```

Deb / Rpm

Coming soon

Usage

Pyc can be started with the following options:

Configuration

Pyc supports a user configuration which adds some features and customization. The configuration must be stored at $HOME/.config/pyc/pyc.yml. A default configuration is located in the repository in pyc.yml.

Let's see how the configuration is written

yaml language: ru shell: exec: "bash" args: - "-l" alias: - чд: cd - пвд: pwd - уич: which output: translate: true prompt: prompt_line: "${USER} on ${HOSTNAME} in ${WRKDIR} ${GIT_BRANCH} ${GIT_COMMIT} ${CMD_TIME}" history_size: 256 translate: false break: enabled: true with: "❯" duration: min_elapsed_time: 2000 rc: ok: "✔" error: "✖" git: branch: "on  " commit_ref_len: 8

Prompt Line Configuration

The prompt configuration is used to setup the prompt line when using the interactive mode. The prompt configuration provides parameters to customize the line printed when interacting with the shell. In addition to the parameters described before, here the prompt line keys are illustrated.

Each prompt line key must have the following syntax ${VAR_NAME}

General keys

| Key | Description | |----------|--------------------------------------------------------------------------| | USER | Username | | HOSTNAME | Hostname | | WRKDIR | Current directory | | LANG | The language configured for Pyc in flag colors of the associated country | | CMDTIME | Execution time of the last command if >= minelapsed_time | | RC | Shows the string associated to a successful exitcode or to an error |

Colors keys

| Key | Description | |----------|-------------| | KYEL | Yellow | | KRED | Red | | KBLU | Blue | | KMAG | Magenta | | KGRN | Green | | KWHT | White | | KBLK | Black | | KGRY | Gray | | KRST | Reset |

Git keys

| Key | Description | |------------|-----------------------------| | GITBRANCH | The current git branch | | GITCOMMIT | The current git commit ref |

Documentation

The developer documentation can be found on Rust Docs at https://docs.rs/pyc-shell

The documentation related to translator modules can be instead found here:

Escape text

It is possible to escape texts (only when the prompt line is visible, not while a program is running), preventing it from being transliterated to latin. To do so, just use quotes:

```sh

Touch foobar.txt

тоуч фообар.ткст ```

Escaped:

```sh

Touch фообар.мксм

тоуч "фообар.ткст" ```


Known issues

Unicode Replacement character while typing (�)

If you see this character when you're typing cyrillic characters, these steps may fix the problem:

Reconfigure locales:

sh sudo dpkg-reconfigure locales

Select all the locales you need from the list, but most important select ru_RU.UTF-8.

Regenerate locales:

sh sudo locale-gen

If this didn't solve your problem it's probably an issue of your terminal. Up to now I've found out that some terminals just don't let you type non-ascii characters when executing an application. These are the terminals which I've used or have been reported which DON'T work.

Cd command in oneshot mode doesn't work

Yep. Unfortunately it seems there's no way to make it work in oneshot mode. If you know a possible way to make it work, please contribute to this project to implement it.

Fish doesn't work

Uuhm, I don't know why, I need some time to investigate why, maybe it doesn't use stdout to write (?).

Shell alias not working

I will fix this soon

Text editors dont' work

I will try to fix this issue


Upcoming Features

Pyc 0.2.0

Others

Contributions

Contributions are welcome! 😉

If you think you can contribute to Рус, please follow Рус's contributions guide

Changelog


License

Licensed under the GNU GPLv3 (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.gnu.org/licenses/gpl-3.0.txt

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.

You can read the entire license HERE