Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
I
inary
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
1
Konular (issue)
1
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
SulinOS
inary
Commits
4088b928
Kaydet (Commit)
4088b928
authored
Şub 06, 2020
tarafından
Ali Rıza Keskin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
noecho ekledim [bitmedi]
üst
02d7d6ea
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
7 deletions
+30
-7
inary-cli
inary-cli
+3
-0
__init__.py
inary/__init__.py
+0
-2
__init__.py
inary/cli/__init__.py
+2
-0
command.py
inary/cli/command.py
+1
-0
ui.py
inary/ui.py
+23
-4
util.py
inary/util.py
+1
-1
No files found.
inary-cli
Dosyayı görüntüle @
4088b928
...
...
@@ -38,6 +38,7 @@ def sig_handler(sig, frame):
def
exit
():
inary
.
util
.
noecho
(
False
)
sys
.
exit
(
1
)
def
handle_exception
(
exception
,
value
,
tb
):
...
...
@@ -94,6 +95,7 @@ def blc_wsl():
if
__name__
==
"__main__"
:
blc_wsl
()
inary
.
util
.
noecho
(
True
)
sys
.
excepthook
=
handle_exception
signal
.
signal
(
signal
.
SIGTERM
,
sig_handler
)
...
...
@@ -102,3 +104,4 @@ if __name__ == "__main__":
if
cli
.
command
.
name
[
1
]
in
"rdb sf"
.
split
():
ctx
.
filesdb
=
inary
.
db
.
filesdb
.
FilesDB
()
cli
.
run_command
()
inary
.
util
.
noecho
(
False
)
inary/__init__.py
Dosyayı görüntüle @
4088b928
...
...
@@ -18,7 +18,6 @@ import atexit
import
importlib
import
logging
import
logging.handlers
import
util
import
os
import
sys
...
...
@@ -69,4 +68,3 @@ atexit.register(_cleanup)
ctx
.
config
=
inary
.
config
.
Config
()
init_logging
()
util
.
noecho
()
inary/cli/__init__.py
Dosyayı görüntüle @
4088b928
...
...
@@ -174,7 +174,9 @@ class CLI(inary.ui.UI):
prompt
=
msg
+
util
.
colorize
(
" "
+
_
(
'(yes'
),
'red'
)
+
'/'
+
util
.
colorize
(
_
(
'no)'
),
'green'
)
+
": "
else
:
prompt
=
msg
+
util
.
colorize
(
" "
+
_
(
'(yes'
),
'green'
)
+
'/'
+
util
.
colorize
(
_
(
'no)'
),
'red'
)
+
": "
util
.
noecho
(
False
)
s
=
input
(
prompt
)
util
.
noecho
(
True
)
if
yes_expr
.
search
(
s
):
return
True
...
...
inary/cli/command.py
Dosyayı görüntüle @
4088b928
...
...
@@ -199,6 +199,7 @@ class Command(object):
def
die
():
"""exit program"""
ctx
.
ui
.
error
(
_
(
'Command terminated abnormally.'
))
util
.
noecho
(
False
)
sys
.
exit
(
-
1
)
...
...
inary/ui.py
Dosyayı görüntüle @
4088b928
...
...
@@ -84,10 +84,29 @@ class UI(object):
"""ask the user to choose from a list of alternatives"""
pass
def
confirm
(
self
,
msg
):
"""ask a yes/no question"""
# default ui confirms everything
return
True
def
confirm
(
self
,
msg
,
invert
=
False
):
msg
=
str
(
msg
)
if
ctx
.
config
.
options
and
ctx
.
config
.
options
.
yes_all
:
return
True
locale
.
setlocale
(
locale
.
LC_ALL
,
""
)
yes_expr
=
re
.
compile
(
locale
.
nl_langinfo
(
locale
.
YESEXPR
))
no_expr
=
re
.
compile
(
locale
.
nl_langinfo
(
locale
.
NOEXPR
))
locale
.
setlocale
(
locale
.
LC_ALL
,
"C"
)
tty
.
tcflush
(
sys
.
stdin
.
fileno
(),
0
)
if
invert
:
prompt
=
msg
+
util
.
colorize
(
" "
+
_
(
'(yes'
),
'red'
)
+
'/'
+
util
.
colorize
(
_
(
'no)'
),
'green'
)
+
": "
else
:
prompt
=
msg
+
util
.
colorize
(
" "
+
_
(
'(yes'
),
'green'
)
+
'/'
+
util
.
colorize
(
_
(
'no)'
),
'red'
)
+
": "
util
.
noecho
(
False
)
s
=
input
(
prompt
)
util
.
noecho
(
True
)
if
yes_expr
.
search
(
s
):
return
True
else
:
return
False
def
display_progress
(
self
,
**
ka
):
"""display progress"""
...
...
inary/util.py
Dosyayı görüntüle @
4088b928
...
...
@@ -396,7 +396,7 @@ def noecho(enabled=True):
if
(
enabled
):
printw
(
"
\x1b
[?25l"
)
else
:
printw
(
"
\x1b
[?25
0
"
)
printw
(
"
\x1b
[?25
h
"
)
def
attron
(
attribute
):
"""Attribute enable"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment