Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
V
vitis
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
6
Issues
6
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Eugene 'Vindex' Stulin
vitis
Commits
352f22e4
Commit
352f22e4
authored
Nov 10, 2019
by
Eugene 'Vindex' Stulin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Case with wrong usage of '--help' with 'show' handled. Closed
#18
parent
64fe6b32
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
30 additions
and
248 deletions
+30
-248
Makefile
Makefile
+3
-2
build-scripts/build_tarball.sh
build-scripts/build_tarball.sh
+7
-4
build-scripts/compile.sh
build-scripts/compile.sh
+4
-2
build-scripts/run_tests.sh
build-scripts/run_tests.sh
+3
-1
source/module_show.d
source/module_show.d
+3
-234
source/version
source/version
+1
-1
testing/testing.sh
testing/testing.sh
+9
-4
No files found.
Makefile
View file @
352f22e4
...
...
@@ -25,8 +25,9 @@ debug:
bin
:
$(BS)
/
$(PLANG_DIRNAME)
compile.sh
$(RELEASE_ARGS)
testing
:
$(BS)
/run_tests.sh
NET_TESTS
=
off
# for checking network functional
test
:
$(BS)
/run_tests.sh
$(NET_TESTS)
doc
:
doc/req-ru/requirements.tex
cd
doc/req-ru/
;
pdflatex requirements.tex
...
...
build-scripts/build_tarball.sh
View file @
352f22e4
#!/bin/bash -e
source
build-scripts/env.sh
set
-x
PKG
=
"
${
APP
}
-
${
VERSION
}
"
PKGNAME
=
"
${
PROJECT
}
-
${
VERSION
}
"
TARNAME
=
"
${
PKGNAME
}
.tar.xz"
mkdir
-p
build/
${
PKG
}
cp
-p
-r
${
ALL
}
build/
${
PKG
}
mkdir
-p
build/
${
PKG
NAME
}
cp
-p
-r
${
ALL
}
build/
${
PKG
NAME
}
/
pushd
build
tar
--xz
-cf
${
PKG
}
.tar.xz
${
PKG
}
tar
--xz
-cf
${
TARNAME
}
${
PKGNAME
}
popd
set
+x
build-scripts/compile.sh
View file @
352f22e4
#!/bin/bash -e
source
build-scripts/env.sh
SRCDIR
=
source
/
SRCDIR
=
source
SRC
=
"
${
SRCDIR
}
/*.d"
BINVERSION
=
$1
# release or debug
...
...
@@ -13,6 +13,7 @@ LDC2_STATIC_OPTS+=" -link-defaultlib-shared=false"
GDC_STATIC_OPTS
=
"-static-libphobos"
DMD_STATIC_OPTS
=
""
STATIC_OPTS
=
""
if
[[
${
PHOBOS_LINKING
}
==
static
]]
;
then
STATIC_OPTS
=
$(
eval echo
\$
${
DC
^^
}
_STATIC_OPTS
)
fi
...
...
@@ -47,8 +48,9 @@ LOCALES_CSV=resources/locales.csv
LOCALES_DTXT
=
source
/locales.dtxt
${
DC
}
${
BS
}
/localesconverter.script.d
${
OUT
}
localesconverter
./localesconverter
"
${
LOCALES_CSV
}
"
"
${
LOCALES_DTXT
}
"
rm
localesconverter localesconverter.o
rm
-f
localesconverter localesconverter.o
mkdir
-p
${
BINPATH_BASEDIR
}
ARGS
=
"-Jsource/
${
STATIC_OPTS
}
${
AMALTHEA_OPTS
}
"
if
[[
$BINVERSION
==
debug
]]
;
then
${
DC
}
${
SRC
}
${
OUT
}${
BINPATH
}
${
ARGS
}
${
DEBUG
}
...
...
build-scripts/run_tests.sh
View file @
352f22e4
#!/bin/bash -e
.
build-scripts/env.sh
NET_TESTS
=
$1
if
[[
!
-e
testing/testing.sh
]]
;
then
echo
"No tests"
exit
...
...
@@ -14,6 +16,6 @@ fi
cp
${
BINPATH
}
testing/
cd
testing
./testing.sh
./testing.sh
$NET_TESTS
cd
-
>
/dev/null
rm
testing/
${
APP
}
source/module_show.d
View file @
352f22e4
...
...
@@ -94,9 +94,6 @@ RunningOptions extractRunningOptions(ref string[] args) {
return
options
;
}
deprecated
bool
flagHidden
;
deprecated
string
msgWrongUsing
;
/*******************************************************************************
* The function manages the commands "show", "open", "run"
...
...
@@ -105,15 +102,15 @@ void mainFn(string[] args) {
CE
command
=
cast
(
CE
)
args
[
0
];
string
err
=
s_
(
"Wrong using of command '"
~
cast
(
string
)
command
~
"'."
);
checkCondition
!
err
(
args
.
length
>=
2
);
if
(
args
[
1
].
among
(
"--help"
,
"-h"
))
{
fnHelp
(
cast
(
string
)
command
);
return
;
}
bool
modeCategoriesList
;
getopt
(
args
,
config
.
passThrough
,
"all-categories"
,
&
modeCategoriesList
);
bool
help
;
getopt
(
args
,
config
.
passThrough
,
"all-categories"
,
&
modeCategoriesList
,
"h|help"
,
&
help
);
checkCondition
!
err
(
help
==
false
);
// here '--help' is wrong option
if
(
command
==
CE
.
e_show
&&
modeCategoriesList
)
{
bool
showAutoCategories
;
getopt
(
args
,
config
.
passThrough
,
"auto"
,
&
showAutoCategories
);
...
...
@@ -127,7 +124,6 @@ void mainFn(string[] args) {
if
(!
args
[
1
].
isOption
)
{
args
=
args
[
0
]
~
[
"-e"
]
~
args
[
1
..
$];
}
bool
showingMode
,
openingMode
,
runningMode
;
MainOptions
mainOptions
=
extractMainOptions
(
args
);
...
...
@@ -579,144 +575,6 @@ private void printCategories(string filepath, bool noColors) {
}
/*******************************************************************************
* The function for command 'vitis show'
*/
deprecated
void
cmdShow
(
string
[
string
]
files
,
string
[]
options
)
{
string
numbers
;
bool
paths
,
noColors
,
noNumbers
,
machine
,
reverse
,
flagCategories
,
details
;
SortEnum
sortEnum
=
SortEnum
.
name
;
//default - sort by name
options
=
"app"
~
options
;
//getopt requires application name
try
getopt
(
options
,
"n|numbers"
,
&
numbers
,
"sort"
,
&
sortEnum
,
"p|paths"
,
&
paths
,
"no-colors"
,
&
noColors
,
"no-numbers"
,
&
noNumbers
,
"m|machine"
,
&
machine
,
"r|reverse"
,
&
reverse
,
"categories"
,
&
flagCategories
,
"details"
,
&
details
);
catch
(
ConvException
e
)
{
throw
new
ValidException
(
"Error among command line flags."
.
_s
);
}
if
(!
stdout
.
isTTY
)
noColors
=
true
;
if
(
machine
)
noNumbers
=
noColors
=
true
;
setColorStdout
(!
noColors
);
setColorStderr
(!
noColors
);
bool
extendedInformation
;
if
(
flagCategories
||
details
)
extendedInformation
=
true
;
string
[]
filepaths
;
//string[] linkpaths;
string
[]
linknames
;
sortBySortEnum
(
sortEnum
,
files
,
linknames
,
filepaths
);
void
subfn_printFileItem
(
string
fileName
,
ssize_t
currNumber
,
ssize_t
maxNumber
)
{
auto
numberOfDigits
=
to
!
string
(
maxNumber
).
length
;
auto
numberOfCurrentDigits
=
to
!
string
(
currNumber
).
length
;
string
categoryPart
;
string
namePart
;
if
(!
noNumbers
)
{
auto
numberOfSpaces
=
numberOfDigits
-
numberOfCurrentDigits
;
for
(
auto
j
=
0
;
j
<
numberOfSpaces
;
++
j
)
write
(
" "
);
"simple"
.
tprint
(
"["
,
currNumber
,
"] "
);
}
ssize_t
indexOfLastSlash
;
indexOfLastSlash
=
lastIndexOf
(
fileName
,
"/"
);
if
(
indexOfLastSlash
>
0
)
{
categoryPart
=
fileName
[
0
..
indexOfLastSlash
];
if
(
machine
)
categoryPart
=
`"`
~
categoryPart
;
"category"
.
tprint
(
categoryPart
);
"slash"
.
tprint
(
"/"
);
}
namePart
=
fileName
[
indexOfLastSlash
+
1
..
$];
if
(
machine
)
namePart
=
paths
?
namePart
~
`"`
:
`"`
~
namePart
~
`"`
;
"filename"
.
tprint
(
namePart
,
"\n"
);
}
auto
printableArray
=
paths
?
filepaths
:
linknames
;
if
(!
flagHidden
)
printableArray
=
printableArray
.
filter
!(
a
=>
!
a
.
startsWith
(
"."
)).
array
;
ssize_t
maxNumber
;
if
(
numbers
)
{
printableArray
=
getRarefiedArrayByNumbers
(
printableArray
,
numbers
);
foreach
(
i
,
f
;
printableArray
)
if
(
""
!=
f
)
maxNumber
=
i
+
1
;
}
else
{
maxNumber
=
linknames
.
length
;
}
if
(
paths
)
foreach
(
ref
el
;
printableArray
)
{
if
(
el
.
endsWith
(
".desktop"
))
{
el
=
getURLFromDesktopFile
(
el
);
}
}
for
(
ssize_t
index
;
index
<
printableArray
.
length
;
++
index
)
{
ssize_t
i
;
string
f
;
if
(!
reverse
)
i
=
index
;
else
i
=
printableArray
.
length
-
1
-
index
;
f
=
printableArray
[
i
];
string
fpath
=
filepaths
[
i
];
if
(
f
==
""
)
continue
;
subfn_printFileItem
(
f
,
i
+
1
,
maxNumber
);
if
(!(
flagCategories
||
details
))
continue
;
if
(
details
)
{
SysTime
st
;
st
=
amalthea
.
fs
.
timeLastModified
(
fpath
);
string
lastModification
=
amalthea
.
sys
.
getTimeString
(
st
);
st
=
amalthea
.
fs
.
timeLastAccessed
(
fpath
);
string
lastAccess
=
amalthea
.
sys
.
getTimeString
(
st
);
string
permissions
=
amalthea
.
sys
.
getUnixModeLine
(
fpath
);
ulong
size
=
std
.
file
.
getSize
(
fpath
);
string
normSize
=
makeHumanOrientedByteSize
(
size
);
string
typeOfOutputForProperty
,
typeOfOutputForValue
;
if
(
noColors
)
{
typeOfOutputForProperty
=
typeOfOutputForValue
=
"simple"
;
}
else
{
typeOfOutputForProperty
=
"details_property"
;
typeOfOutputForValue
=
"details_value"
;
}
typeOfOutputForProperty
.
tprint
(
"Modified: "
.
_s
);
typeOfOutputForValue
.
tprint
(
lastModification
,
"\t"
);
typeOfOutputForProperty
.
tprint
(
"Permissions: "
.
_s
);
typeOfOutputForValue
.
tprint
(
permissions
,
"\n"
);
typeOfOutputForProperty
.
tprint
(
"Accessed: "
.
_s
);
typeOfOutputForValue
.
tprint
(
lastAccess
,
"\t"
);
typeOfOutputForProperty
.
tprint
(
"Size: "
.
_s
);
typeOfOutputForValue
.
tprint
(
normSize
,
" ("
,
size
,
" "
,
"B"
.
_s
,
")"
);
"simple"
.
tprint
(
"\n"
);
}
if
(
flagCategories
)
{
string
[]
currentCategories
=
getCategoriesOfFile
(
fpath
);
currentCategories
=
std
.
algorithm
.
sort
(
currentCategories
).
array
;
foreach
(
j
,
c
;
currentCategories
)
{
string
typeOfOutput
=
noColors
?
"simple"
:
"category_details"
;
typeOfOutput
.
tprint
(
`"`
~
c
~
`"`
);
if
(
currentCategories
.
length
-
1
!=
j
)
typeOfOutput
.
tprint
(
" "
);
}
"simple"
.
tprint
(
"\n"
);
}
// if (printableArray.length-1 != i && (flagCategories || details))
// "simple".tprint("\n");
}
}
string
makeHumanOrientedByteSize
(
ulong
bytes
)
{
long
getExponent
(
ulong
x
)
{
if
(
x
==
0
)
return
0
;
...
...
@@ -762,95 +620,6 @@ unittest {
}
/*******************************************************************************
* The function for command 'vitis open'
*/
deprecated
void
cmdOpen
(
string
[
string
]
files
,
string
[]
options
)
{
string
numbers
;
bool
savedPage
;
bool
flagMix
;
bool
reverse
;
string
openingApp
;
SortEnum
sortEnum
=
SortEnum
.
name
;
//default - sort by name
options
=
"app"
~
options
;
//getopt requires application name
try
getopt
(
options
,
"n"
,
&
numbers
,
"sort"
,
&
sortEnum
,
"saved-page"
,
&
savedPage
,
"app"
,
&
openingApp
,
"mix"
,
&
flagMix
,
"r|reverse"
,
&
reverse
);
catch
(
ConvException
e
)
{
throw
new
ValidException
(
"Error among command line flags."
.
_s
);
}
string
[]
filepaths
,
linknames
;
sortBySortEnum
(
sortEnum
,
files
,
linknames
,
filepaths
);
if
(
openingApp
.
empty
)
{
openingApp
=
VitisConf
.
getOpener
();
}
string
openingCommand
=
openingApp
;
void
subfn_fileIsApplication
(
string
f
)
{
string
command
=
`xdg-mime query filetype `
~
`"`
~
f
.
replace
(
`"`
,
`\"`
)
~
`"`
;
string
fileType
=
getAppOutput
(
command
);
if
(
"application/x-executable"
==
fileType
)
{
string
message
=
f
~
s_
(
": this file is application. "
~
"Perhaps it is not intended to be opened."
);
terminalOutput
(
"warning"
,
message
,
"\n"
);
}
}
string
[]
resultArray
;
if
(
numbers
)
{
resultArray
=
getRarefiedArrayByNumbers
(
filepaths
,
numbers
);
}
else
{
resultArray
=
filepaths
.
dup
;
}
if
(
reverse
)
{
std
.
algorithm
.
reverse
(
resultArray
);
}
if
(
flagMix
)
{
import
std
.
random
:
randomShuffle
;
randomShuffle
(
resultArray
);
}
foreach
(
ref
f
;
resultArray
)
{
if
(
""
==
f
)
continue
;
if
(
startsWith
(
f
.
baseName
,
"."
)
&&
!
flagHidden
)
continue
;
f
=
f
.
replace
(
`"`
,
`\"`
);
if
(
endsWith
(
f
,
".desktop"
))
{
if
(
savedPage
)
{
/*
auto savedURL = getFieldFromDesktopFile(f, "URL[saved]");
auto savedPagePath = getVitisHTMLPath ~ savedURL;
if (!savedURL.empty && exists(savedPagePath)) {
f = savedPagePath;
} else if (!savedURL.empty) {
"warning".tprint(savedPagePath,
": saved page is not found."._s, " ",
"Skipped."._s, "\n");
continue;
} else {
"warning".tprint("Saved page is not found."._s, " ",
"Skipped."._s, "\n");
continue;
}*/
}
else
{
f
=
getURLFromDesktopFile
(
f
);
}
}
subfn_fileIsApplication
(
f
);
openingCommand
~=
" "
~
"\""
~
f
~
"\""
;
}
//writeln(openingCommand);
c_system
(
openingCommand
);
}
private
string
[]
getCategoriesOfFile
(
string
file
)
{
string
[]
linkedCategories
;
string
[]
autoCategories
;
...
...
source/version
View file @
352f22e4
0.11
0.11
.1
\ No newline at end of file
testing/testing.sh
View file @
352f22e4
...
...
@@ -5,6 +5,10 @@
################################################################################
TEST_MODE
=
'auto'
NET_TESTS
=
off
if
[[
"
$1
"
==
"--net"
]]
;
then
NET_TESTS
=
on
fi
################################################################################
# CONSTANTS
...
...
@@ -2052,12 +2056,13 @@ Icon=text-html"
}
procedure_2_8
()
{
[[
$NET_TESTS
==
off
]]
&&
return
procedure_title
"PROCEDURE 2.8 'Network Bookmarks'"
#
case_2_8_1
#
case_2_8_2
#
case_2_8_3
case_2_8_1
case_2_8_2
case_2_8_3
case_2_8_4
#
case_2_8_5
case_2_8_5
}
case_2_9_1
()
{
...
...
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