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
ee34102d
Kaydet (Commit)
ee34102d
authored
Tem 24, 2021
tarafından
ğ
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
inarysh script mode added
üst
27c4bb9a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
10 deletions
+26
-10
inarysh
scripts/inarysh
+21
-10
inary-script.ish
tests/shelltest/inary-script.ish
+5
-0
No files found.
scripts/inarysh
Dosyayı görüntüle @
ee34102d
...
...
@@ -26,6 +26,7 @@ libreadline.readline.argtypes=[c_char_p]
import
inary.ui
import
inary.context
as
ctx
from
inary.cli.inarycli
import
InaryCLI
import
inary.util
import
gettext
gettext
.
bindtextdomain
(
'inary'
,
"/usr/share/locale"
)
...
...
@@ -62,9 +63,6 @@ def handle_exception(exception, value, tb):
elif
isinstance
(
value
,
KeyboardInterrupt
):
ui
.
error
(
_
(
"
\n
Keyboard Interrupt: Exiting..."
))
exit
()
elif
isinstance
(
value
,
EOFError
):
ui
.
error
(
_
(
"
\n
Keyboard Interrupt [Ctrl-D]: Exiting..."
))
exit
()
elif
isinstance
(
value
,
inary
.
errors
.
Exception
):
show_traceback
=
True
ui
.
error
(
_
(
"
\n
Unhandled internal exception.
\n
"
...
...
@@ -99,6 +97,9 @@ if __name__ == "__main__":
locale
.
setlocale
(
locale
.
LC_ALL
,
''
)
sys
.
excepthook
=
handle_exception
signal
.
signal
(
signal
.
SIGTERM
,
sig_handler
)
script
=
None
if
len
(
sys
.
argv
)
>
1
:
script
=
open
(
sys
.
argv
[
1
],
"r"
)
ui
=
inary
.
cli
.
CLI
()
# make a temporary UI
ui
.
info
(
_
(
"Welcome to the interactive INARY shell.
\n
"
"Type 'help' to see a list of commands.
\n
"
...
...
@@ -111,17 +112,27 @@ if __name__ == "__main__":
sys
.
excepthook
=
handle_exception
try
:
cmd
=
libreadline
.
readline
(
'inary >> '
.
encode
(
"utf-8"
))
.
decode
(
"utf-8"
)
if
script
==
None
:
cmd
=
libreadline
.
readline
(
inary
.
util
.
colorize
(
'inary >> '
,
color
=
"green"
)
.
encode
(
"utf-8"
))
if
cmd
==
None
:
ui
.
error
(
_
(
"
\n
Keyboard Interrupt [Ctrl-D]: Exiting..."
))
break
cmd
=
cmd
.
decode
(
"utf-8"
)
else
:
cmd
=
script
.
readline
()
if
cmd
.
strip
()
==
'exit'
:
ctx
.
ui
.
info
(
_
(
'Bye!'
))
ui
.
info
(
_
(
'Bye!'
))
break
elif
"cd"
==
cmd
.
split
()[
0
]:
os
.
chdir
(
cmd
.
replace
(
"cd "
,
""
))
elif
cmd
.
startswith
(
'!'
):
cmd
=
cmd
[
1
:]
os
.
system
(
cmd
)
if
"cd"
==
cmd
.
split
()[
0
]:
os
.
chdir
(
cmd
.
replace
(
"cd "
,
""
))
elif
cmd
.
startswith
(
'!'
):
os
.
system
(
os
.
environ
[
"SHELL"
])
else
:
os
.
system
(
cmd
)
else
:
cli
=
InaryCLI
(
cmd
.
split
())
cli
.
run_command
()
except
:
pass
except
Exception
as
e
:
ui
.
error
(
str
(
e
))
tests/shelltest/inary-script.ish
0 → 100755
Dosyayı görüntüle @
ee34102d
#!/usr/bin/inarysh
!pwd
list-installed
info inary
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