Skip to content

Commit

Permalink
Update docs. Add some small functions. Examples now have their own du…
Browse files Browse the repository at this point in the history
…b.json
  • Loading branch information
FreeSlave committed Jun 9, 2015
1 parent 6caf213 commit 8a50c1c
Show file tree
Hide file tree
Showing 9 changed files with 176 additions and 89 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Ddox:

### Desktop util

Utility that can parse and execute .desktop files.
Utility that can parse, execute and rewrites .desktop files.
This will start vlc with the first parameter set to ~/Music:

dub run desktopfile:desktoputil -- exec /usr/share/applications/vlc.desktop ~/Music
Expand All @@ -40,6 +40,14 @@ Should start command line application in terminal emulator:

dub run desktopfile:desktoputil -- exec /usr/share/applications/python2.7.desktop

Open link with preferred application:

dub run desktopfile:desktoputil -- link /usr/share/desktop-base/debian-homepage.desktop

Starts .desktop file defined executable or opens link:

dub run desktopfile:desktoputil -- start /path/to/file.desktop

Parse and write .desktop file to new location:

dub run desktopfile:desktoputil -- write /usr/share/applications/vlc.desktop ~/Desktop/vlc.desktop
Expand Down
26 changes: 1 addition & 25 deletions dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,5 @@
"targetPath" : "lib",
"targetType" : "library",

"subPackages" : [
{
"name" : "desktoputil",
"targetPath" : "bin",
"targetType" : "executable",
"targetName" : "desktoputil",
"sourcePaths" : ["examples/desktoputil"],
"importPaths" : ["source"],
"dependencies" : {
"desktopfile" : "*"
}
},
{
"name" : "desktoptest",
"targetPath" : "bin",
"targetType" : "executable",
"targetName" : "desktoptest",
"sourcePaths" : ["examples/desktoptest"],
"importPaths" : ["source"],
"dependencies" : {
"desktopfile" : "*",
"standardpaths" : "~>0.1.2"
}
}
]
"subPackages" : ["./examples/desktoptest", "./examples/desktoputil"]
}
5 changes: 5 additions & 0 deletions examples/desktoptest/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.dub
docs.json
__dummy.html
*.o
*.obj
13 changes: 13 additions & 0 deletions examples/desktoptest/dub.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "desktoptest",
"description": "A minimal D application.",
"copyright": "Copyright © 2015, freeslave",
"authors": ["freeslave"],
"dependencies": {
"desktopfile" : "*",
"standardpaths" : "~>0.1.2"
},
"targetPath" : "bin",
"targetType" : "executable",
"targetName" : "desktoptest",
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void main(string[] args)
try {
new DesktopFile(entry);
}
catch(DesktopFileException e) {
catch(IniLikeException e) {
stderr.writefln("Error reading %s: at %s: %s", entry, e.lineNumber, e.msg);
}
}
Expand Down
5 changes: 5 additions & 0 deletions examples/desktoputil/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.dub
docs.json
__dummy.html
*.o
*.obj
12 changes: 12 additions & 0 deletions examples/desktoputil/dub.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "desktoputil",
"description": "A minimal D application.",
"copyright": "Copyright © 2015, freeslave",
"authors": ["freeslave"],
"dependencies": {
"desktopfile" : "*"
},
"targetPath" : "bin",
"targetType" : "executable",
"targetName" : "desktoputil",
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import desktopfile;
void main(string[] args)
{
if (args.length < 3) {
writefln("Usage: %s <read|exec|link|write> <desktop-file> <optional arguments>", args[0]);
writefln("Usage: %s <read|exec|link|start|write> <desktop-file> <optional arguments>", args[0]);
return;
}

Expand All @@ -24,7 +24,10 @@ void main(string[] args)
writeln("Exec:", df.expandExecString(urls));
df.startApplication(urls);
} else if (command == "link") {
writeln("Link:", df.url());
df.startLink();
} else if (command == "start") {
df.start();
} else if (command == "write") {
if (args.length > 3) {
string outFile = args[3];
Expand Down
Loading

0 comments on commit 8a50c1c

Please sign in to comment.