diff --git a/README.md b/README.md index c233949..0c04abb 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,13 @@ We offer many data files for this utility in several additional packages, a few The **fortune** utility exits 0 on success, and >0 if an error occurs. In particular, if *-l*, *-m*, or *-s* is specified, failure to find a matching citation in the selected files counts as an error. +## EXAMPLES +Boxing the fortune output with [echobox(1)](https://github.com/HubTou/echobox/blob/main/README.md): + +``` +/usr/local/bin/fortune unix-philosophy unix-quotes | echobox -S single +``` + ## SEE ALSO [cowsay(1)](https://linux.die.net/man/1/cowsay), [echobox(1)](https://github.com/HubTou/echobox/blob/main/README.md), diff --git a/man/fortune.6 b/man/fortune.6 index 650d10f..c4ec39a 100644 --- a/man/fortune.6 +++ b/man/fortune.6 @@ -31,7 +31,7 @@ .\" @(#)fortune.6 8.3 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd August 9, 2021 +.Dd September 26, 2021 .Dt FORTUNE 6 .Os .Sh NAME @@ -241,6 +241,12 @@ or .Fl s is specified, failure to find a matching citation in the selected files counts as an error. +.Sh EXAMPLES +Boxing the fortune output with +.Xr echobox 1 : +.Bd -literal +/usr/local/bin/fortune unix-philosophy unix-quotes | echobox -S single +.Ed .Sh SEE ALSO .Xr cowsay 1 , .Xr echobox 1 , diff --git a/setup.cfg b/setup.cfg index 9c9f275..ea9ec97 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,7 +3,7 @@ name = pnu-fortune description = print a random, hopefully interesting, adage long_description = file: README.md long_description_content_type = text/markdown -version = 1.0.2 +version = 1.0.3 license = BSD 3-Clause License license_files = License author = Hubert Tournier @@ -23,6 +23,16 @@ classifiers = Operating System :: Microsoft :: Windows Programming Language :: Python :: 3 Programming Language :: Python :: 3.0 + Programming Language :: Python :: 3.1 + Programming Language :: Python :: 3.2 + Programming Language :: Python :: 3.3 + Programming Language :: Python :: 3.4 + Programming Language :: Python :: 3.5 + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 Topic :: Games/Entertainment Topic :: Games/Entertainment :: Fortune Cookies Topic :: System diff --git a/src/fortune/main.py b/src/fortune/main.py index 0ac3a38..6be3732 100644 --- a/src/fortune/main.py +++ b/src/fortune/main.py @@ -16,7 +16,7 @@ import rot13 # Version string used by the what(1) and ident(1) commands: -ID = "@(#) $Id: fortune - print a random, hopefully interesting, adage v1.0.2 (August 13, 2021) by Hubert Tournier $" +ID = "@(#) $Id: fortune - print a random, hopefully interesting, adage v1.0.3 (September 26, 2021) by Hubert Tournier $" # Default parameters. Can be overcome by environment variables, then command line options parameters = { @@ -43,6 +43,14 @@ } +################################################################################ +def initialize_debugging(program_name): + """Debugging set up""" + console_log_format = program_name + ": %(levelname)s: %(message)s" + logging.basicConfig(format=console_log_format, level=logging.DEBUG) + logging.disable(logging.INFO) + + ################################################################################ def display_help(): """Displays usage and help""" @@ -126,7 +134,7 @@ def process_environment_variables(): if os.path.isdir(pnu_fortune_path): parameters["Path"].append(pnu_fortune_path) - pnu_fortune_path2=sys.executable.replace("python.exe", "share" + os.sep + "games" + os.sep + "fortune") + pnu_fortune_path2 = sys.base_prefix + os.sep + "share" + os.sep + "games" + os.sep + "fortune" if os.path.isdir(pnu_fortune_path2): parameters["Path"].append(pnu_fortune_path2) @@ -637,16 +645,14 @@ def select_fortune(file): def main(): """The program's main entry point""" program_name = os.path.basename(sys.argv[0]) - exit_status = 0 - - console_log_format = program_name + ": %(levelname)s: %(message)s" - logging.basicConfig(format=console_log_format, level=logging.DEBUG) - logging.disable(logging.INFO) + initialize_debugging(program_name) process_environment_variables() arguments = process_command_line() fortune_files = process_arguments(arguments) + exit_status = 0 + if parameters["List files"]: list_files(fortune_files)