A light-weight CLI application with a great emphasis on performance, written in the C
programming language and POSIX sh
.
DD(o)L enables you to learn daily vocabulary inputs right from your Terminal window, hence called a CLI application. It contains several tweakable options to fit everyone's needs.
In general, pure GUI -based apps are substantially slower than CLI -based programs. This application, which was written in C
and then built to a Unix executable, can load and query thousands of words in a fraction of a second and places a strong emphasis on overall performance!
- Clone the repo
$ git clone https://github.com/michalspano/daily-dose-lang.git && cd daily-dose-lang
As a result, global support is used (i.e., one can run the programmes with all required dependencies outside the scope of the project). This step is optional, and it can be ignored if the global support isn't required. Albeit, if you prefer, go to the project's root and type:
$ ./install <config_path>
This script is responsible for creating aliases in the selected config file, such as ~/.bashrc
, ~/.zshrc
, etc.
NOTE: this method is primarily compatible with Unix-like systems (e.g., macOS, Linux, etc.). Hence, additional (customized) options might be required for Windows users. Consider setting an alias in Microsoft's Powershell (a viable option for Windows users).
*install
has been designed to recognize a valid installation, so no need to worry about duplicate insertions.
Navigate to daily-dose-lang/install
and under Personal Adjustments
, feel
free to change any of the default names (i.e., the key-words enclosed with double quote marks ""
) such as:
alias "ddol"=$PATH
*Replace $PATH
with the relative path of the script that the alias refers to.
NOTE: be cautious to leave out any redundant whitespace which can result in an error.
In order to disable an alias, simply remove it from the specified config
file.
The following command lists the structure of the project per the current version.
$ ./schema.sh
Overall, the bin
folder contains strictly executables
, database
contains supported word-lists, dist
stores locally parsed data from an API. We can find several .sh
, .h
and .c
files in the root of the project. Lastly, package.json
contains a node dependency
that can be:
- Listed by typing:
$ npm list
- Installed by typing:
$ sudo npm install -g google-translate-cli
*We need to install the dependency globally, therefore using the -g
flag. The reason for that: a global dependency can be invoked virtually from any location within the systen, hence supporting a system-wide scope. In order to install a package globally, the command has to be run as an administrator or root user.
- In Unix-like systems, this is achieved using the
sudo
command (before thenpm
command). - In Windows, we simply need to run the task with the administrator privileges.
NOTE: the accuracy of the translations might not be as precise as desired and is planned to be improved in the following versions.
NOTE: the following commands will be run from the directory's root directory. All of the scripts, however, can be called globally with the necessary dependencies. Consider the following example:
$ ./PATH/to/daily-dose-lang/foo
The entries are time limited by default, as the project's name implies, with 12h = 1 entry
.
./run.sh $WORDLIST
There is no time limit, so you can retrieve as many entries as you want:
./run.sh $WORDLIST -ul, --unlimited-mode
* $WORDLIST
represents the source from database
directory and will be used in the following examples for brevity.
There's a script that can list all supported word-lists from 'database':*
$ ./dict_list
* By default, it will display the keys of the supported inputs. They are, however, valid, because run.sh
has a parser that can comprehend such behavior.
In practice, given by a pseudo-code:
FOR file IN DATABASE_DIR
REMOVE file extension of $file, REMEMBER $file's base name
IF $file matches $key
APPEND the relative path to the script
BREAK
ELSE
RETAIN $key
You can optionally - if you prefer so - list the relative paths of the inputs (respective to the root directory):
$ ./dict_list -f, --full
Alternatively, use the help flag:
$ ./dict_list -h, --help
Displaying the latest entry:
$./mount.sh
* If the user is unable to retrieve a new entry owing to a time limit, mount.sh
is automatically invoked (in the default behavior).