Skip to content

Commit

Permalink
Merge branch 'cli'
Browse files Browse the repository at this point in the history
  • Loading branch information
gertjanvanzwieten committed Aug 8, 2023
2 parents d351dc4 + d69b567 commit a1eb9d2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion nutils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'Numerical Utilities for Finite Element Analysis'

__version__ = version = '9a1'
__version__ = version = '9a2'
version_name = 'jook-sing'
12 changes: 12 additions & 0 deletions nutils/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,18 @@ def in_context(*args, **kwargs):
return in_context_wrapper


def log_version(f):

from . import version, version_name

@functools.wraps(f)
def log_version(*args, **kwargs):
treelog.info(f'NUTILS {version} "{version_name.title()}"')
return f(*args, **kwargs)

return log_version


def log_arguments(f):
'''Decorator to log a function's arguments.
Expand Down
1 change: 1 addition & 0 deletions nutils/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def run(f, *, argv=None):
util.in_context(util.log_traceback),
util.in_context(util.post_mortem),
warnings.via(treelog.warning),
util.log_version,
util.log_arguments,
util.timeit(),
)
Expand Down

0 comments on commit a1eb9d2

Please sign in to comment.