shell match case

This commit is contained in:
Mert Gör 🇹🇷 2024-07-29 20:06:00 +03:00
parent f82311b62d
commit 6e519aedbc
Signed by: hwpplayer1
GPG key ID: 03E547D043AB6C8F

View file

@ -0,0 +1,14 @@
while True:
cmd = input('CSD>').split()
match cmd:
case ('delete', path) | ('remove', path) | ('erase', path):
print(f'{path} dosyası siliniyor')
case 'copy', source_path, dest_path:
print(f'{source_path} dosyası {dest_path} olarak kopyalanıyor')
case 'rename', oldname, newname:
print(f'{oldname} dosyanının ismi {newname} olarak değiştiriliyor')
case 'exit' | 'quit':
break
case _:
print('geçeriz komut!')