فهرست منبع

cmd_shell: create ~/.kamcli folder if not exists and history is enabled

Daniel-Constantin Mierla 5 سال پیش
والد
کامیت
479f6675ea
1فایلهای تغییر یافته به همراه4 افزوده شده و 0 حذف شده
  1. 4 0
      kamcli/commands/cmd_shell.py

+ 4 - 0
kamcli/commands/cmd_shell.py

@@ -385,6 +385,10 @@ def cli(ctx, nohistory, nosyntax):
     prompt_kwargs = {}
 
     if not nohistory:
+        dirName = os.path.expanduser("~/.kamcli")
+        if not os.path.exists(dirName):
+            os.mkdir(dirName)
+            click.echo("directory '" + dirName + "' created")
         prompt_kwargs.update(
             {"history": FileHistory(os.path.expanduser("~/.kamcli/history"))}
         )