From 8a8d8691bd9451c5ad03f76a338159d87c4b1f18 Mon Sep 17 00:00:00 2001 From: Antoine Eiche Date: Tue, 26 Jul 2016 12:51:26 +0200 Subject: [PATCH] Add migrator for bash related names It migrates - BashComplete -> ShellComplete - EnableBashCompletion -> EnableShellCompletion - BashCompletionFlag -> GenerateCompletionFlag --- cli-v1-to-v2 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/cli-v1-to-v2 b/cli-v1-to-v2 index 2c83720..36e1cd5 100755 --- a/cli-v1-to-v2 +++ b/cli-v1-to-v2 @@ -298,6 +298,23 @@ def _app_init(source): 'cli\\.NewApp\\(\\)', '(&cli.App{})', source, flags=re.UNICODE ) +@_migrator +def _bash_complete(source): + return re.sub( + 'BashComplete:', 'ShellComplete:', + re.sub('\\.BashComplete', '.ShellComplete', source, flags=re.UNICODE)) + +@_migrator +def _enable_bash_completion(source): + return re.sub( + '\\.EnableBashCompletion', '.EnableShellCompletion', source, flags=re.UNICODE + ) + +@_migrator +def _bash_completion_flag(source): + return re.sub( + 'cli\\.BashCompletionFlag', 'cli.GenerateCompletionFlag', source, flags=re.UNICODE + ) def test_migrators(): import difflib