You won't have to worry about the way you say "Good night" any more!
Just run this script and it will generate a random goodnight message for your loved one.
The author declines all responsibility for any conflict caused by the (over)use of this script. 😉
Note
Don't hesitate and report any kind of malfunction or request a feature by opening an issue!
Feel free to also check the code of conduct and contributing guide.
🚀 Build & Launch
make
./goodnight.py [OPTIONS]
🛠️ Options
--default Launch once with default values (ignores other parameters)
--no-copy Do not copy the result to clipboard
-b, --bounds (x,y) Bounds for the random range of how many phrases to draw (def: 2,5)
-n, --nb-phrases <int> Number of phrases to draw
-e, --emoji Add emoji after each phrase (from source file)
-s, --source <str> Source file to pull contents (phrases...) from (def: ./assets/default.log)
-w, --for-whom <str> For whom the goodnight is (def: "" [no name used])
-N, --nick-nth <int> Place the nickname after the nth phrase (def: 0 [random placement])
-r, --allow-repetition Allow repetition of phrases if you ask for more than there are in the source file
-o, --other-step Use the even-numbered phrase gaps as "and"s instead of commas (def: odd-)
-a, --alternate Alternate between "and"s, and emoji instead of commas (requires -e)
-t, --times <int> Generate and print a given amount of goodnights (def: 1)
-i, --infinite Toggle infinite mode
-d, --delay <val> Add delay after each iteration, in milliseconds (def: 0) | 'p': press Enter to continue
--ignore Ignore preferences file
-S, --save Save configuration to preferences file
-p, --pref-file <str> Use a specific preferences file (def: preferences.sav)
--verbose Toggle verbose mode
-h, --help Display this help and exit
♨️ Default Behavior & Equivalents
./goodnight.py --bounds=2,5 --source="./assets/default.log" --for-whom="" --pref-file="./assets/preferences.sav"
./goodnight.py -b "2,5" -s "assets/source" -w "" -p "assets/preferences"
./goodnight.py --default
make default_run
📑 General Information
- Fear not having to copy the result of the program, it will be automatically copied to your clipboard! 😉 (unless
--no-copy
is present) - Your preferences are automatically saved upon the first launch unless specified otherwise (see above:
-i
).- You can also create a preferences file manually, see above:
-p
; Find a tutorial in default.sav. - Settings will be set based on parameters; all unfilled parameters will be based on the preference file; if there are still unfilled parameters, the CLI will ask you for them.
- You can also create a preferences file manually, see above:
- Though Ctrl+D cannot be caught in this script, you can use Ctrl+C to exit at any time.
-b
and-n
, just like-t
and-i
, are mutually exclusive. If both are provided, the program will exit with an error.-o
naturally has no effect if there is only one phrase, or-e
is present.- A file named default.log serves as the default source file for phrases, emoji and nicknames.
- You may create your own
.log
source file (see above:-s
). Open default.log to see how to format your own.
- You may create your own
- The
--for-whom
option overrides nicknames provided by a source file.
This program was tested on and designed for Ubuntu 22.04; it is WSL2-compatible.
It uses the Pyperclip module to copy its results to your clipboard; you may need to install it through make install
, using pip
.
Pyperclip itself uses a clipboard package, which you may need to install as well. Refer to Pyperclip's documentation for more information.
Caution
goodnight.py's code is written in Python 3.10 and is not compatible with anterior versions.
You can check your Python version by running python --version
in your terminal.
Only the major checkpoints of the project will be listed in this paragraph.
The exhaustive and detailed changelog is available here.
- [DEV 0.0.0] Oct 30 2023: Project creation.
- [DEV 0.1.0] Nov 02 2023: Project comprehends its core components: phrases, emoji, nickname, weighting.
- [DEV 0.2.0] Nov 06 2023: Project generates goodnights using its core components, added fancy options.
- [DEV 0.2.5] Nov 13 2023: Code security and quality was improved, new options were added.
- [DEV 0.3.0] Jan 06 2024: Repo was enhanced, quality was improved, a Makefile and new options were added.