Skip to content

Conversation

@kmvanbrunt
Copy link
Member

@kmvanbrunt kmvanbrunt commented Oct 31, 2019

Moving a bit of code around to shrink cmd2.py

  • Moved cmd2 decorators into a new file called decorators.py
  • Moved some constants from cmd2.py to constants.py
  • Made some cmd2 module constants cmd2.Cmd class constants

    This includes moving cmd2 decorators into a new file called decorators.py
    Moved some constants from cmd2.py to constants.py
@codecov
Copy link

codecov bot commented Oct 31, 2019

Codecov Report

Merging #798 into master will decrease coverage by 0.02%.
The diff coverage is 96.69%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #798      +/-   ##
==========================================
- Coverage   96.94%   96.91%   -0.03%     
==========================================
  Files          14       15       +1     
  Lines        3499     3506       +7     
==========================================
+ Hits         3392     3398       +6     
- Misses        107      108       +1
Impacted Files Coverage Δ
cmd2/__init__.py 0% <0%> (ø) ⬆️
cmd2/cmd2.py 96.53% <100%> (-0.16%) ⬇️
cmd2/decorators.py 100% <100%> (ø)
cmd2/constants.py 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 245dc33...4ea04bc. Read the comment docs.

Copy link
Member

@tleonhardt tleonhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmd2.py is a huge file which predominantly contains the cmd2.Cmd class. I salute anything which moves other stuff out of there and shrinks it in size.

return arg_decorator


class _SavedReadlineSettings:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are moving things out of cmd2.py, should we consider moving _SavedReadlineSettings to rl_utils.py and _SavedCmd2Env to utils.py?

passed to commands:

.. automethod:: cmd2.cmd2.with_argument_list
.. automethod:: cmd2.decorators.with_argument_list
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it should be autofunction instead of automethod here? Or should it be automethod in the api/decorators.rst file? Or does it just not matter?

@tleonhardt tleonhardt merged commit a18eef6 into master Nov 2, 2019
@tleonhardt tleonhardt deleted the refactoring branch November 2, 2019 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants