Skip to content
This repository has been archived by the owner on Apr 1, 2020. It is now read-only.

Commit

Permalink
Use main() in all scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
zrzka committed Sep 30, 2017
1 parent 1abfb19 commit 57d7c9a
Show file tree
Hide file tree
Showing 16 changed files with 32 additions and 32 deletions.
4 changes: 2 additions & 2 deletions blackmamba/script/action_quickly.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def tableview_cell_for_row(self, tv, section, row):
return cell


def action_quickly():
def main():
def run_wrench_item(item, shift_enter):
item.action_info.run(delay=1.0)

Expand All @@ -60,4 +60,4 @@ def run_wrench_item(item, shift_enter):


if __name__ == '__main__':
action_quickly()
main()
4 changes: 2 additions & 2 deletions blackmamba/script/analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def _editor_text():
return text


def analyze():
def main():
path = editor.get_path()

if not path:
Expand Down Expand Up @@ -218,4 +218,4 @@ def analyze():


if __name__ == '__main__':
analyze()
main()
4 changes: 2 additions & 2 deletions blackmamba/script/clear_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import editor


def clear_annotations():
def main():
editor.clear_annotations()


if __name__ == '__main__':
clear_annotations()
main()
4 changes: 2 additions & 2 deletions blackmamba/script/close_all_tabs_except_current_one.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import blackmamba.ide.tab as tab


def close_all_tabs_except_current_one():
def main():
tab.close_tabs_except_current()


if __name__ == '__main__':
close_all_tabs_except_current_one()
main()
4 changes: 2 additions & 2 deletions blackmamba/script/find_usages.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def open_location(item, shift_enter):
v.wait_modal()


def find_usages():
def main():
if not get_config_value('general.jedi', False):
log.warn('find_usages disabled, you can enable it by setting general.jedi to True')
return
Expand Down Expand Up @@ -123,4 +123,4 @@ def find_usages():


if __name__ == '__main__':
find_usages()
main()
4 changes: 2 additions & 2 deletions blackmamba/script/jump_to_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def open_location(item, shift_enter):
v.wait_modal()


def jump_to_definition():
def main():
if not get_config_value('general.jedi', False):
log.warn('jump_to_definition disabled, you can enable it by setting general.jedi to True')
return
Expand Down Expand Up @@ -127,4 +127,4 @@ def jump_to_definition():


if __name__ == '__main__':
jump_to_definition()
main()
4 changes: 2 additions & 2 deletions blackmamba/script/jump_to_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import console


def jump_to_line():
def main():
try:
input = console.input_alert('Jump to line...', 'Empty (or invalid) value to dismiss.')
source.scroll_to_line(int(input))
Expand All @@ -17,4 +17,4 @@ def jump_to_line():


if __name__ == '__main__':
jump_to_line()
main()
4 changes: 2 additions & 2 deletions blackmamba/script/new_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import blackmamba.ide.tab as tab


def new_file():
def main():
tab.new_file()


if __name__ == '__main__':
new_file()
main()
4 changes: 2 additions & 2 deletions blackmamba/script/new_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import blackmamba.ide.tab as tab


def new_tab():
def main():
tab.new_tab()


if __name__ == '__main__':
new_tab()
main()
4 changes: 2 additions & 2 deletions blackmamba/script/open_quickly.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def expand_folder(f):
self.items = sorted(items)


def open_quickly():
def main():
def allow_file(root, name):
return not name.startswith('.')

Expand Down Expand Up @@ -89,4 +89,4 @@ def open_file(item, shift_enter):


if __name__ == '__main__':
open_quickly()
main()
4 changes: 2 additions & 2 deletions blackmamba/script/outline_quickly.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def _generate_nodes(parent, level=0, breadcrumb=''):
return nodes


def outline_quickly():
def main():
filename = editor.get_path()
if not filename:
return
Expand Down Expand Up @@ -90,4 +90,4 @@ def scroll_to_node(node, shift_enter):


if __name__ == '__main__':
outline_quickly()
main()
4 changes: 2 additions & 2 deletions blackmamba/script/run_quickly.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def expand_folder(f):
self.items = sorted(items)


def run_quickly():
def main():
def allow_file(root, name):
return path.is_python_file(name) and not name.startswith('.')

Expand Down Expand Up @@ -89,4 +89,4 @@ def run_script(item, shift_enter):


if __name__ == '__main__':
run_quickly()
main()
4 changes: 2 additions & 2 deletions blackmamba/script/run_unit_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def _run_unit_tests(path):
console.hide_output()


def run_script_unit_tests():
def main():
path = editor.get_path()

if not path:
Expand All @@ -129,4 +129,4 @@ def run_script_unit_tests():


if __name__ == '__main__':
run_script_unit_tests()
main()
4 changes: 2 additions & 2 deletions blackmamba/script/search_dash.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def _query():
return text[bi:ei]


def search_dash(query=None):
def main(query=None):
"""Opens Dash documentation browser.
If you do not provide query, current selection will be used. If there's
Expand All @@ -65,4 +65,4 @@ def search_dash(query=None):


if __name__ == '__main__':
search_dash()
main()
4 changes: 2 additions & 2 deletions blackmamba/script/show_documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def action(item, shift_enter):
v.wait_modal()


def show_documentation():
def main():
if not get_config_value('general.jedi', False):
log.warn('show_documentation disabled, you can enable it by setting general.jedi to True')
return
Expand Down Expand Up @@ -120,4 +120,4 @@ def show_documentation():


if __name__ == '__main__':
show_documentation()
main()
4 changes: 2 additions & 2 deletions blackmamba/script/toggle_comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def _toggle_lines(lines):


@Pythonista()
def toggle_comments():
def main():
import editor

selection_range = editor.get_selection()
Expand Down Expand Up @@ -118,4 +118,4 @@ def toggle_comments():


if __name__ == '__main__':
toggle_comments()
main()

0 comments on commit 57d7c9a

Please sign in to comment.