[~] Refactor

This commit is contained in:
Siarhei Siniak 2024-11-22 23:08:18 +03:00
parent 2522ed4ac4
commit 34c3ed74eb
3 changed files with 75 additions and 7 deletions

@ -0,0 +1,46 @@
// Place your key bindings in this file to override the defaults
[
{
"key": "alt+z",
"command": "-editor.action.toggleWordWrap"
},
{
"key": "alt+z",
"command": "-workbench.action.terminal.sizeToContentWidth",
"when": "terminalFocus && terminalHasBeenCreated && terminalIsOpen || terminalFocus && terminalIsOpen && terminalProcessSupported"
},
{
"key": "alt+z",
"command": "workbench.action.toggleMaximizeEditorGroup",
"when": "editorPartMaximizedEditorGroup || editorPartMultipleEditorGroups"
},
{
"key": "ctrl+k ctrl+m",
"command": "-workbench.action.toggleMaximizeEditorGroup",
"when": "editorPartMaximizedEditorGroup || editorPartMultipleEditorGroups"
},
{
"key": "alt+z",
"command": "workbench.action.toggleMaximizedPanel",
"when": "!editorTextFocus"
},
{
"key": "ctrl+p",
"command": "-extension.vim_ctrl+p",
"when": "editorTextFocus && vim.active && vim.use<C-p> && !inDebugRepl || vim.active && vim.use<C-p> && !inDebugRepl && vim.mode == 'CommandlineInProgress' || vim.active && vim.use<C-p> && !inDebugRepl && vim.mode == 'SearchInProgressMode'"
},
{
"key": "alt+t",
"command": "workbench.action.terminal.toggleTerminal",
"when": "terminal.active"
},
{
"key": "ctrl+`",
"command": "-workbench.action.terminal.toggleTerminal",
"when": "terminal.active"
},
{
"key": "ctrl+e",
"command": "-workbench.action.quickOpen"
}
]

@ -9,6 +9,7 @@ import datetime
import functools
import io
import json
import pathlib
import logging
import optparse
import os
@ -1610,9 +1611,9 @@ def aioice_tunnel(argv: list[str]) -> None:
return locals()
t1 = await test()
#t1 = await test()
await asyncio.sleep(999)
#await asyncio.sleep(999)
def player_v1(folder_url, item_id):
#import sys
@ -3688,6 +3689,13 @@ def install(argv: list[str]) -> None:
type=pathlib.Path,
required=True,
)
parser.add_argument(
'-p', '--relative',
type=pathlib.Path,
help='copy source relative to path, allows to strip extra components',
dest='relative',
default=None,
)
parser.add_argument(
'-t', '--target',
type=pathlib.Path,
@ -3700,25 +3708,39 @@ def install(argv: list[str]) -> None:
help='overwrite if target is present',
dest='overwrite',
action='store_true',
defualt=False,
default=False,
)
options, args = parser.parse_known_args(argv)
if options.relative:
relative_source = options.source.relative_to(options.relative)
else:
if options.source.is_absolute():
relative_source = options.source.relative_to('/')
else:
relative_source = options.source
logger.info(dict(source=options.source, target=options.source))
if options.target.exists():
final_target = options.target / relative_source
logger.info(dict(final_target=final_target, relative_source=relative_source))
if final_target.exists():
if not options.overwrite:
raise NotImplementedError
shutil.rmtree(str(options.target))
shutil.rmtree(str(final_target))
if option.source.is_dir() and not options.recursive:
if options.source.is_dir() and not options.recursive:
raise NotImplementedError
os.makedirs(final_target, exist_ok=True,)
shutil.copy(
options.source,
options.target,
final_target,
)
logger.info(dict(msg='done'))