Source code for almanac.shortcuts.builtins

from ..constants import ExitCodes
from ..pages import PagePath, PagePathLike
from ..context import current_app
from ..core import ArgumentDecoratorProxy

_arg = ArgumentDecoratorProxy()

@_arg.path(description='The path to change into.')
async def cd(path: PagePath) -> int:
    """Change directories."""
    app = current_app()


    return ExitCodes.OK

[docs]async def help() -> int: """Print help text about the current page or a command.""" app = current_app() # XXX'Called help') return ExitCodes.OK
@_arg.path(description='The path whose contents to list.') async def ls(path: PagePathLike = '.') -> int: """List files in a directory.""" app = current_app() for child_page in app.page_navigator[path].children: return ExitCodes.OK
[docs]async def back() -> int: """Change to the previous directory in the page navigation history.""" app = current_app() app.page_navigator.back() return ExitCodes.OK
[docs]async def forward() -> int: """Change to the next directory in the page navigation history.""" app = current_app() app.page_navigator.forward() return ExitCodes.OK
[docs]async def pwd() -> int: """Print the current directory.""" app = current_app() return ExitCodes.OK
[docs]async def quit() -> int: """Quit the application.""" app = current_app()'Quitting!') app.quit() return ExitCodes.OK