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
7250af95
Kaydet (Commit)
7250af95
authored
Tem 05, 2005
tarafından
Eray Özkural
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
* ne salagim
üst
71bf3fea
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
110 additions
and
0 deletions
+110
-0
pisi-cli
pisi/pisi-cli
+110
-0
No files found.
pisi/pisi-cli
0 → 100755
Dosyayı görüntüle @
7250af95
#!/usr/bin/python
# -*- coding: utf-8 -*-
import
sys
from
optparse
import
OptionParser
import
pisi
from
pisi.cli
import
buildhelper
,
installhelper
,
indexhelper
usage
=
"""
%
prog COMMAND [ARGUMENTS] [options]
Where commands are bla bla...
"""
class
PisiCLI
(
object
):
def
__init__
(
self
):
parser
=
OptionParser
(
usage
=
usage
,
version
=
"
%
prog "
+
pisi
.
__version__
)
parser
.
add_option
(
"-D"
,
"--destdir"
,
action
=
"store"
)
parser
.
add_option
(
"-u"
,
"--username"
,
action
=
"store"
)
parser
.
add_option
(
"-p"
,
"--password"
,
action
=
"store"
)
parser
.
add_option
(
"-P"
,
action
=
"store_true"
,
dest
=
"getpass"
,
default
=
False
,
help
=
"Get password from the command line"
)
parser
.
add_option
(
"-v"
,
"--verbose"
,
action
=
"store_true"
,
dest
=
"verbose"
,
default
=
False
,
help
=
"detailed output"
)
parser
.
add_option
(
"-d"
,
"--debug"
,
action
=
"store_true"
,
default
=
True
)
parser
.
add_option
(
"-n"
,
"--dry-run"
,
action
=
"store_true"
,
default
=
False
,
help
=
"do not perform any action, just show what
\
would be done"
)
(
options
,
args
)
=
parser
.
parse_args
()
self
.
parser
=
parser
try
:
self
.
cmd
=
args
[
0
]
self
.
args
=
args
[
1
:]
self
.
options
=
options
except
IndexError
:
print
usage
sys
.
exit
(
1
)
self
.
authInfo
=
None
self
.
checkAuthInfo
()
def
checkAuthInfo
(
self
):
username
=
self
.
options
.
username
password
=
self
.
options
.
password
if
not
username
and
not
password
:
return
# No authentication
elif
username
and
password
:
self
.
authInfo
=
(
username
,
password
)
return
# TODO: yapılandırma dosyasını da kontrol et. Belki orada
# tanımlanmıştır?
if
username
and
self
.
options
.
getpass
:
from
getpass
import
getpass
password
=
getpass
(
"Password: "
)
self
.
authInfo
=
(
username
,
password
)
return
# FIX: her komut için ayrı help
def
help
(
self
,
command
=
""
):
if
not
self
.
args
:
print
usage
return
self
.
parser
.
print_help
()
def
install
(
self
):
if
not
self
.
args
:
self
.
help
(
"install"
)
for
arg
in
self
.
args
:
installhelper
.
install
(
arg
)
def
build
(
self
):
if
not
self
.
args
:
self
.
help
(
"build"
)
for
arg
in
self
.
args
:
buildhelper
.
build
(
arg
,
self
.
authInfo
)
def
updateindex
(
self
):
"""Update the repos db with the given index file (pisi-index.xml)"""
if
len
(
self
.
args
)
!=
1
:
self
.
help
(
"updateindex"
)
indexfile
=
self
.
args
[
0
]
indexhelper
.
updateindex
(
indexfile
)
def
runCommand
(
self
):
commands
=
{
"help"
:
self
.
help
,
"install"
:
self
.
install
,
"build"
:
self
.
build
,
"updateindex"
:
self
.
updateindex
}
for
key
in
commands
.
keys
():
if
key
==
self
.
cmd
:
commands
[
key
]()
break
if
__name__
==
"__main__"
:
cli
=
PisiCLI
()
cli
.
runCommand
()
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