-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
862: allow
piccolo migrations new all --auto
(#864)
* allow `piccolo migrations new all --auto` * remove unused import * fix old docstring * make sure the correct app config is being used * rearrange print statements * improve UI when making migrations * add test for app sorting
- Loading branch information
1 parent
a3a6b87
commit 2e23271
Showing
7 changed files
with
191 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
def get_fixed_length_string(string: str, length=20) -> str: | ||
""" | ||
Add spacing to the end of the string so it's a fixed length. | ||
Add spacing to the end of the string so it's a fixed length, or truncate | ||
if it's too long. | ||
""" | ||
if len(string) > length: | ||
return f"{string[: length - 3]}..." | ||
spacing = "".join(" " for _ in range(length - len(string))) | ||
return f"{string}{spacing}" | ||
|
||
|
||
def print_heading(string: str, width: int = 64) -> None: | ||
""" | ||
Prints out a nicely formatted heading to the console. Useful for breaking | ||
up the output in large CLI commands. | ||
""" | ||
print(f"\n{string.upper():^{width}}") | ||
print("-" * width) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters