Skip to content

Commit

Permalink
Update to v1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
HubTou authored Sep 26, 2021
1 parent 09018d8 commit 59c5800
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 9 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
8 changes: 7 additions & 1 deletion man/fortune.6
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 ,
Expand Down
12 changes: 11 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
20 changes: 13 additions & 7 deletions src/fortune/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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"""
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 59c5800

Please sign in to comment.