def test_filename_formatting(): assert click.format_filename(b"foo.txt") == "foo.txt" assert click.format_filename(b"/x/foo.txt") == "/x/foo.txt" assert click.format_filename("/x/foo.txt") == "/x/foo.txt" assert click.format_filename("/x/foo.txt", shorten=True) == "foo.txt" # filesystem encoding on windows permits this. if not WIN: assert click.format_filename(b"/x/foo\xff.txt", shorten=True) == "foo\udcff.txt"
def test_filename_formatting(): assert click.format_filename(b'foo.txt') == 'foo.txt' assert click.format_filename(b'/x/foo.txt') == '/x/foo.txt' assert click.format_filename(u'/x/foo.txt') == '/x/foo.txt' assert click.format_filename(u'/x/foo.txt', shorten=True) == 'foo.txt' # filesystem encoding on windows permits this. if not WIN: assert click.format_filename(b'/x/foo\xff.txt', shorten=True) \ == u'foo\ufffd.txt'
def cli(ctx, path): """Initializes a repository.""" if path is None: path = ctx.home ctx.log('Initialized the repository in %s', click.format_filename(path))