Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
See what's new at GitLab
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
d536d93b
Commit
d536d93b
authored
Dec 30, 2019
by
Eugene 'Vindex' Stulin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimization of displaying file list with categories
parent
a4d9644d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
91 additions
and
25 deletions
+91
-25
source/module_RPN.d
source/module_RPN.d
+6
-4
source/module_show.d
source/module_show.d
+27
-19
source/module_vitis_base.d
source/module_vitis_base.d
+57
-1
source/version
source/version
+1
-1
No files found.
source/module_RPN.d
View file @
d536d93b
...
...
@@ -151,13 +151,14 @@ static string[] toReversePolishNotation(string[] infixNotation) {
*/
string
[
string
]
calculateExpression
(
in
string
[]
expr
)
{
validateExpression
(
expr
);
string
[]
expression
=
expr
.
dup
;
alias
string
[
string
]
AssociativeArray
;
AssociativeArray
[]
intermediateData
;
if
(
1
==
expression
.
length
)
{
expression
=
expression
~
[
"u:"
]
~
expression
;
}
string
[]
RPN
=
toReversePolishNotation
(
expression
);
foreach
(
ref
el
;
RPN
)
{
if
(
el
.
etype
==
ET
.
CATEGORY
)
{
string
category
=
getCatDirPath
(
el
);
//getVitisPath ~ el;//;
...
...
@@ -168,16 +169,16 @@ string[string] calculateExpression(in string[] expr) {
}
}
string
[][]
arrayWithFileLists
;
ET
[]
arrayWithElementTypes
;
string
[
string
]
assArrayWithLinkLists
;
foreach
(
el
;
RPN
)
{
arrayWithElementTypes
~=
el
.
etype
;
if
(
ET
.
CATEGORY
==
el
.
etype
)
{
auto
symlinksInfo
=
getSymlinksInfo
(
el
);
assArrayWithLinkLists
=
mixAssociativeArrays
(
assArrayWithLinkLists
,
el
.
getS
ymlinksInfo
);
arrayWithFileLists
~=
el
.
getS
ymlinksInfo
.
values
;
s
ymlinksInfo
);
arrayWithFileLists
~=
s
ymlinksInfo
.
values
;
}
else
{
arrayWithFileLists
~=
null
;
}
...
...
@@ -219,5 +220,6 @@ string[string] calculateExpression(in string[] expr) {
}
}
}
return
resultLinks
;
}
source/module_show.d
View file @
d536d93b
...
...
@@ -137,7 +137,7 @@ void mainFn(string[] args) {
if
(
command
==
CE
.
e_show
)
{
showingOptions
=
extractShowingOptions
(
args
);
getopt
(
args
,
config
.
passThrough
,
"open"
,
&
openingMode
,
"run"
,
&
runningMode
);
"run"
,
&
runningMode
);
if
(
openingMode
)
openingOptions
=
extractOpeningOptions
(
args
);
if
(
runningMode
)
runningOptions
=
extractRunningOptions
(
args
);
}
else
if
(
command
==
CE
.
e_open
)
{
...
...
@@ -263,6 +263,20 @@ void showFilesByExpression(string[] expression,
void
showFilesByFileList
(
string
[
string
]
fileList
,
MainOptions
mainOptions
,
ShowingOptions
opts
)
{
string
[]
categoriesOfFile
;
auto
typeOfOutput
=
opts
.
noColors
?
"simple"
:
"category_details"
;
void
subfnPrintCategories
()
{
auto
lastIndex
=
categoriesOfFile
.
length
-
1
;
foreach
(
i
,
c
;
categoriesOfFile
)
{
typeOfOutput
.
tprint
(
`"`
~
c
~
`"`
);
if
(
lastIndex
!=
i
)
{
typeOfOutput
.
tprint
(
" "
);
}
else
{
"simple"
.
tprint
(
"\n"
);
}
}
}
setColorStdout
(!
opts
.
noColors
);
setColorStderr
(!
opts
.
noColors
);
...
...
@@ -275,7 +289,6 @@ void showFilesByFileList(string[string] fileList,
size_t
[
string
]
numbersOfRepeatedNames
=
groupByFilePathWithNumbers
(
files
);
string
[]
filepaths
,
linkpaths
;
sortBySortEnum
(
mainOptions
.
sortEnum
,
files
,
filepaths
,
linkpaths
);
string
[]
printableLinkPaths
,
printableFilePaths
;
ssize_t
maxNumber
;
if
(!
mainOptions
.
numbers
.
empty
)
{
...
...
@@ -291,8 +304,12 @@ void showFilesByFileList(string[string] fileList,
}
for
(
ssize_t
index
;
index
<
printableLinkPaths
.
length
;
index
++)
{
ssize_t
i
=
index
;
if
(
mainOptions
.
reverse
)
i
=
printableLinkPaths
.
length
-
1
-
index
;
ssize_t
i
;
if
(!
mainOptions
.
reverse
)
{
i
=
index
;
}
else
{
i
=
printableLinkPaths
.
length
-
1
-
index
;
}
string
linkPath
=
printableLinkPaths
[
i
];
if
(
linkPath
==
""
)
continue
;
auto
linkName
=
linkPath
.
baseName
;
...
...
@@ -300,6 +317,10 @@ void showFilesByFileList(string[string] fileList,
auto
noNumbers
=
opts
.
noNumbers
;
auto
machine
=
opts
.
machineOutput
;
if
(
opts
.
categories
)
{
categoriesOfFile
=
getCategoriesOfFile
(
filePath
);
}
auto
numberOfRepeating
=
numbersOfRepeatedNames
[
linkPath
];
printLinkNameLine
(
linkName
,
i
+
1
,
maxNumber
,
noNumbers
,
machine
,
numberOfRepeating
);
...
...
@@ -307,7 +328,7 @@ void showFilesByFileList(string[string] fileList,
if
(
opts
.
ipaths
)
printNetPath
(
filePath
);
if
(
opts
.
details
)
printDetails
(
filePath
,
opts
.
noColors
);
if
(
opts
.
fragmentInfo
)
printFragmentInfo
(
filePath
);
if
(
opts
.
categories
)
printCategories
(
filePath
,
opts
.
noColors
);
if
(
opts
.
categories
)
subfnPrintCategories
(
);
}
}
...
...
@@ -578,19 +599,6 @@ private auto getFragmentData(string filepath) {
}
private
void
printCategories
(
string
filepath
,
bool
noColors
)
{
string
[]
categories
=
getCategoriesOfFile
(
filepath
);
foreach
(
i
,
c
;
categories
)
{
string
typeOfOutput
=
noColors
?
"simple"
:
"category_details"
;
typeOfOutput
.
tprint
(
`"`
~
c
~
`"`
);
if
(
categories
.
length
-
1
!=
i
)
typeOfOutput
.
tprint
(
" "
);
else
"simple"
.
tprint
(
"\n"
);
}
}
string
makeHumanOrientedByteSize
(
ulong
bytes
)
{
long
getExponent
(
ulong
x
)
{
if
(
x
==
0
)
return
0
;
...
...
@@ -648,7 +656,7 @@ private string[] getCategoriesOfFile(string file) {
if
(
file
.
isSymlink
)
file
=
file
.
readLink
;
else
if
(!
file
.
startsWith
(
'/'
))
file
=
pwd
~
"/"
~
file
;
string
[
string
]
allLinks
=
moduleBase
.
getAllLinks
();
string
[
string
]
allLinks
=
getAllLinksFromCache
();
foreach
(
l
,
lf
;
allLinks
)
{
if
(
lf
!=
file
)
continue
;
...
...
source/module_vitis_base.d
View file @
d536d93b
...
...
@@ -388,6 +388,22 @@ string[] getTopLevelCategoriesAndAliases(
return
usercategories
~
autocategories
;
}
// without autocategories and without aliases
string
[]
getNoAutoCategories
(
Flag
!
"fullPath"
fullPath
=
No
.
fullPath
)
{
auto
categories
=
amalthea
.
fs
.
getDirListRecurse
(
getVitisPath
)
.
filter
!(
a
=>
!
a
.
baseName
.
startsWith
(
"__"
))
.
filter
!(
a
=>
!
a
.
directoryOfFilePath
.
startsWith
(
"__"
))
.
filter
!(
a
=>
!
a
.
isSymlink
)
.
array
;
if
(!
fullPath
)
{
size_t
l
=
getVitisPath
().
length
;
foreach
(
ref
cat
;
categories
)
{
cat
=
cat
[
l
..
$];
}
}
return
categories
;
}
string
[]
getAllCategoriesAndAliases
(
Flag
!
"fullPath"
fullPath
=
No
.
fullPath
)
{
//exclude unnecessary catalogies for repeared files and service catalogies
auto
categories
=
amalthea
.
fs
.
getDirListRecurse
(
getVitisPath
)
...
...
@@ -423,7 +439,14 @@ string[] getAliases(Flag!"fullPath" fullPath = No.fullPath) {
string
[]
getTopLevelAutoCategories
(
Flag
!
"fullPath"
fullPath
=
No
.
fullPath
)
{
if
(!
getAutoCategoriesPath
().
exists
)
return
null
;
return
amalthea
.
fs
.
getDirList
(
getAutoCategoriesPath
);
auto
autoCategories
=
amalthea
.
fs
.
getDirList
(
getAutoCategoriesPath
);
if
(!
fullPath
)
{
size_t
l
=
getVitisPath
().
length
;
foreach
(
ref
cat
;
autoCategories
)
{
cat
=
cat
[
l
..
$];
}
}
return
autoCategories
;
}
string
[]
getAllAutoCategories
(
Flag
!
"fullPath"
fullPath
=
Yes
.
fullPath
)
{
...
...
@@ -560,6 +583,21 @@ string[string] getAllLinks() {
return
allLinks
;
}
string
[
string
]
getAllLinksFromCache
()
{
static
bool
firstFunctionCall
=
true
;
static
string
[
string
]
allLinks
;
if
(!
firstFunctionCall
)
return
allLinks
;
string
[]
allTopCategories
=
getTopLevelCategories
();
foreach
(
category
;
allTopCategories
)
{
auto
temp
=
amalthea
.
fs
.
getSymlinksInfo
(
category
);
//recursively
foreach
(
k
,
v
;
temp
)
allLinks
[
k
]
=
v
;
}
firstFunctionCall
=
false
;
return
allLinks
;
}
deprecated
string
[]
findFilesInVitis
(
string
file
)
{
string
[]
categories
=
getTopLevelCategories
(
No
.
fullPath
);
...
...
@@ -813,3 +851,21 @@ void printErrorMessage(string msg) {
stderr
.
writeln
(
" "
,
msg
);
}
deprecated
alias
exceptionHandler
=
printErrorMessage
;
debug
class
Timer
{
import
std
.
datetime
.
stopwatch
,
core
.
thread
;
StopWatch
sw
;
this
()
{
sw
=
StopWatch
(
AutoStart
.
no
);
}
void
start
()
{
sw
.
start
();
}
void
finish
(
bool
noprint
=
false
)
{
sw
.
stop
();
writeln
(
sw
.
peek
.
total
!
"usecs"
,
" microseconds"
);
sw
.
reset
();
}
}
\ No newline at end of file
source/version
View file @
d536d93b
0.13~pre2
\ No newline at end of file
0.13~pre3
\ No newline at end of file
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