Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
Terminal user interface- command line
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Arjun Sundaram
Terminal user interface- command line
Commits
6a4971b2
Commit
6a4971b2
authored
9 years ago
by
Francesco Andreuzzi
Browse files
Options
Downloads
Patches
Plain Diff
fixed duplicated commands
parent
79099496
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/src/main/java/ohi/andre/consolelauncher/commands/raw/shellcommands.java
+28
-6
28 additions, 6 deletions
...ohi/andre/consolelauncher/commands/raw/shellcommands.java
with
28 additions
and
6 deletions
app/src/main/java/ohi/andre/consolelauncher/commands/raw/shellcommands.java
+
28
−
6
View file @
6a4971b2
package
ohi.andre.consolelauncher.commands.raw
;
import
java.io.File
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Set
;
import
ohi.andre.comparestring.Compare
;
import
ohi.andre.consolelauncher.R
;
...
...
@@ -17,20 +23,36 @@ public class shellcommands implements CommandAbstraction {
@Override
public
String
exec
(
ExecInfo
info
)
throws
Exception
{
List
<
String
>
cmds
=
Tuils
.
getOSCommands
();
Collection
<
String
>
cmds
=
getOSCommands
();
List
<
String
>
commands
=
new
ArrayList
<>(
cmds
);
Collections
.
sort
(
c
m
ds
,
new
Comparator
<
String
>()
{
Collections
.
sort
(
c
omman
ds
,
new
Comparator
<
String
>()
{
@Override
public
int
compare
(
String
lhs
,
String
rhs
)
{
return
Compare
.
alphabeticCompare
(
lhs
,
rhs
);
}
});
Tuils
.
addPrefix
(
c
m
ds
,
Tuils
.
DOUBLE_SPACE
);
Tuils
.
addSeparator
(
c
m
ds
,
Tuils
.
TRIBLE_SPACE
);
Tuils
.
insertHeaders
(
c
m
ds
,
true
);
Tuils
.
addPrefix
(
c
omman
ds
,
Tuils
.
DOUBLE_SPACE
);
Tuils
.
addSeparator
(
c
omman
ds
,
Tuils
.
TRIBLE_SPACE
);
Tuils
.
insertHeaders
(
c
omman
ds
,
true
);
return
Tuils
.
toPlanString
(
cmds
,
""
);
return
Tuils
.
toPlanString
(
commands
,
Tuils
.
EMPTYSTRING
);
}
private
final
String
[]
path
=
{
"/system/bin"
,
"/system/xbin"
};
private
Set
<
String
>
getOSCommands
()
{
Set
<
String
>
commands
=
new
HashSet
<>();
for
(
String
s
:
path
)
{
commands
.
addAll
(
Arrays
.
asList
(
new
File
(
s
).
list
()));
}
return
commands
;
}
@Override
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment