Compare commits

..

No commits in common. "74825f34a777282ec7e153a6e57b7e95ca24a319" and "5b3ea6e976bb07eca77536f81fe0bb1da398f661" have entirely different histories.

4 changed files with 14 additions and 28 deletions

View file

@ -7,8 +7,4 @@ Language: Cpp
# Force pointers to the type for C++.
DerivePointerAlignment: false
PointerAlignment: Left
# Break after every argument or not at all
BinPackArguments: false
BinPackParameters: false
---

6
flake.lock generated
View file

@ -42,11 +42,11 @@
]
},
"locked": {
"lastModified": 1633726775,
"narHash": "sha256-imcgx7bHP0qzRNu31jknZAzze71pWnEbMbnBcZYxXMg=",
"lastModified": 1631170176,
"narHash": "sha256-RLN/kur2Kpxt0cJp0Fms8ixuGpT8IHX0OpeQ8u8f0X4=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "77b45d526e4dcc1f26ce449f5dc561f2e6eb5db6",
"rev": "3ed0e618cebc1ff291c27b749cf7568959cac028",
"type": "github"
},
"original": {

View file

@ -49,12 +49,15 @@
checks = {
pre-commit = pre-commit-hooks.lib.${system}.run {
src = ./.;
src = self;
hooks = {
clang-format = {
enable = true;
types_or = [ "c++" ];
name = "clang-format";
entry = "${pkgs.clang-tools}/bin/clang-format -style=file -i";
types = [ "text" "c++" ];
language = "system";
};
nixpkgs-fmt = {
@ -69,9 +72,10 @@
defaultPackage = packages.dragger;
devShell = pkgs.mkShell {
inputsFrom = with packages; [
dragger
];
nativeBuildInputs = with pkgs; [ ]
++ defaultPackage.nativeBuildInputs
++ defaultPackage.buildInputs
;
inherit (checks.pre-commit) shellHook;
};

View file

@ -1,5 +1,4 @@
#include <QApplication>
#include <QCommandLineParser>
#include <QDebug>
#include <QDrag>
#include <QFile>
@ -10,23 +9,10 @@
int main(int argc, char* argv[]) {
QApplication app(argc, argv);
QApplication::setApplicationName("dragger");
QApplication::setApplicationVersion("0.1.0");
QCommandLineParser parser;
parser.setApplicationDescription("A CLI drag-and-drop tool");
parser.addHelpOption();
parser.addVersionOption();
parser.addPositionalArgument(
"files",
QCoreApplication::translate("files", "files to drag-and-drop"),
"[FILES...]");
parser.process(app);
QList<QUrl> urls;
for (auto const& path : parser.positionalArguments()) {
QFileInfo file{QFile{path}};
for (int i = 1; i < argc; ++i) {
QFileInfo file(QFile(argv[i]));
if (file.exists()) {
urls << QUrl("file:" + file.absoluteFilePath());
} else {