diff --git a/.clang-format b/.clang-format index 22d4205..f47e7d6 100644 --- a/.clang-format +++ b/.clang-format @@ -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 --- diff --git a/.woodpecker/check.yml b/.woodpecker/check.yml deleted file mode 100644 index 921c363..0000000 --- a/.woodpecker/check.yml +++ /dev/null @@ -1,31 +0,0 @@ -labels: - type: exec - -pipeline: -- name: flake check - image: bash - commands: - - nix flake check - -- name: package check - image: bash - commands: - - nix build - -- name: notify - image: bash - secrets: - - source: matrix_roomid - target: room - - source: matrix_username - target: user - - source: matrix_password - target: pass - - source: matrix_homeserver - target: address - commands: - - nix run github:ambroisie/matrix-notifier - when: - status: - - failure - - success diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 8aa2645..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) [year] [fullname] - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/src/dragger.cc b/dragger.cc similarity index 52% rename from src/dragger.cc rename to dragger.cc index 7c08b83..87c59e4 100644 --- a/src/dragger.cc +++ b/dragger.cc @@ -1,5 +1,4 @@ #include -#include #include #include #include @@ -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 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 { diff --git a/dragger.pro b/dragger.pro index 62c7379..6015b89 100644 --- a/dragger.pro +++ b/dragger.pro @@ -1,3 +1,3 @@ -SOURCES = src/dragger.cc +SOURCES = dragger.cc CONFIG += qt QT += widgets diff --git a/flake.lock b/flake.lock index 37d0752..00c49b4 100644 --- a/flake.lock +++ b/flake.lock @@ -1,65 +1,28 @@ { "nodes": { - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, "flake-utils": { "locked": { - "lastModified": 1678901627, - "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", + "lastModified": 1631561581, + "narHash": "sha256-3VQMV5zvxaVLvqqUrNz3iJelLw30mIVSfZmAaauM3dA=", "owner": "numtide", "repo": "flake-utils", - "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", + "rev": "7e5bf3925f6fbdfaf50a2a7ca0be2879c4261d19", "type": "github" }, "original": { "owner": "numtide", - "ref": "main", + "ref": "master", "repo": "flake-utils", "type": "github" } }, - "gitignore": { - "inputs": { - "nixpkgs": [ - "pre-commit-hooks", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1660459072, - "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", - "owner": "hercules-ci", - "repo": "gitignore.nix", - "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "gitignore.nix", - "type": "github" - } - }, "nixpkgs": { "locked": { - "lastModified": 1680273054, - "narHash": "sha256-Bs6/5LpvYp379qVqGt9mXxxx9GSE789k3oFc+OAL07M=", + "lastModified": 1633329294, + "narHash": "sha256-0LpQLS4KMgxslMgmDHmxG/5twFlXDBW9z4Or1iOrCvU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "3364b5b117f65fe1ce65a3cdd5612a078a3b31e3", + "rev": "ee084c02040e864eeeb4cf4f8538d92f7c675671", "type": "github" }, "original": { @@ -69,40 +32,21 @@ "type": "github" } }, - "nixpkgs-stable": { - "locked": { - "lastModified": 1678872516, - "narHash": "sha256-/E1YwtMtFAu2KUQKV/1+KFuReYPANM2Rzehk84VxVoc=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "9b8e5abb18324c7fe9f07cb100c3cd4a29cda8b8", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-22.11", - "repo": "nixpkgs", - "type": "github" - } - }, "pre-commit-hooks": { "inputs": { - "flake-compat": "flake-compat", "flake-utils": [ "flake-utils" ], - "gitignore": "gitignore", "nixpkgs": [ "nixpkgs" - ], - "nixpkgs-stable": "nixpkgs-stable" + ] }, "locked": { - "lastModified": 1680170909, - "narHash": "sha256-FtKU/edv1jFRr/KwUxWTYWXEyj9g8GBrHntC2o8oFI8=", + "lastModified": 1631170176, + "narHash": "sha256-RLN/kur2Kpxt0cJp0Fms8ixuGpT8IHX0OpeQ8u8f0X4=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "29dbe1efaa91c3a415d8b45d62d48325a4748816", + "rev": "3ed0e618cebc1ff291c27b749cf7568959cac028", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 7e5ca9b..42cfda1 100644 --- a/flake.nix +++ b/flake.nix @@ -1,12 +1,12 @@ { - description = "A CLI drag-and-drop tool"; + description = "A simple calculator"; inputs = { flake-utils = { type = "github"; owner = "numtide"; repo = "flake-utils"; - ref = "main"; + ref = "master"; }; nixpkgs = { @@ -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; }; @@ -81,12 +85,19 @@ }; }) // { overlay = final: prev: { - dragger = with final; qt5.mkDerivation { + dragger = with final; stdenv.mkDerivation { pname = "dragger"; version = "0.1.0"; src = self; + buildInputs = [ + libsForQt5.qt5.qtbase + ]; + nativeBuildInputs = [ + libsForQt5.qt5.wrapQtAppsHook + ]; + configurePhase = '' qmake ''; @@ -95,14 +106,6 @@ mkdir -p $out/bin cp dragger $out/bin ''; - - meta = with lib; { - description = "A CLI drag-and-drop tool"; - homepage = "https://gitea.belanyi.fr/ambroisie/dragger"; - license = licenses.mit; - maintainers = with maintainers; [ ambroisie ]; - platforms = platforms.all; - }; }; }; };