Professional IronPython


Putting Everything Together



Download 20,35 Mb.
Pdf ko'rish
bet222/453
Sana01.07.2022
Hajmi20,35 Mb.
#723045
1   ...   218   219   220   221   222   223   224   225   ...   453
Putting Everything Together
Now that you have a basic understanding of the required help screen elements, it’s time to look at an 
example. Listing 10-5 shows a typical 
usage()
function. It displays help information to users who 
need it, using simple 
print()
statements.
LISTINg 10-5: 
 Creating a help screen for your application
# Create a usage() function.
def usage():
print ‘Welcome to the command line example.’
print ‘This application shows basic command line argument reading.’
print ‘\nUsage:’
print ‘\tIPY CmdLine2.py [Options]‘
print ‘\nOptions:’
print ‘\t-D: Places application in debug mode.’
print ‘\t-h or -? or --help: Displays this help message.’
print ‘\t-g: or --Greet:: Displays a simple greeting.’
print ‘\t-s or --Hello: Displays a simple hello message.’
print ‘\nExamples:’
print ‘\tIPY CmdLine2.py -s outputs Hello!’
print ‘\tIPY CmdLine2.py -g:John outputs Good to see you John’
print ‘\tYou can use either the - or / as command line switches.’
print ‘\tFor example, IPY CmdLine2.py /s outputs Hello!’
Notice the use of formatting in the code. The code places section titles at the left and an extra 
space below the previous section. Section content is indented so it appears as part of the section. 
Figure 10-5 shows the output from this code. Even though this help screen is quite simple, it pro-
vides everything needed for someone to use the example application to test command line switches.
Including Other Elements
Some command line application help screens become enormous and hard to use. In fact, some of 
Microsoft’s own utilities have help that’s several layers deep. Just try drilling into the 
Net
utility 
sometime and you’ll discover just how cumbersome the help can become. Of course, you do want to 
document everything for the user. As an alternative, some command line application developers will 
provide an overview as part of the application, and then include a URL for detailed material online. 
It’s not a perfect solution because you can’t always count on the user having an Internet connection, 
but it does work most of the time.
You don’t have to stop with simple information redirection as part of your help. Some utilities include 
a phone number (just in case the user really is lacking that Internet connection). E-mail addresses aren’t 
unusual, and some developers get creative in providing other helpful tips. It’s also important to take 
ownership of your application by including a company or developer name. If copyright is important, 
then you should provide a copyright notice as well. The thing is to make it easy for someone to identify 
your command line application without cluttering up the help screens too much.
548592c10.indd 206
2/24/10 12:48:31 PM
www.finebook.ir



Download 20,35 Mb.

Do'stlaringiz bilan baham:
1   ...   218   219   220   221   222   223   224   225   ...   453




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish