LCOV - code coverage report
Current view: top level - src - plugins.c (source / functions) Hit Total Coverage
Test: rapport Lines: 0 21 0.0 %
Date: 2021-12-10 16:22:55 Functions: 0 2 0.0 %
Branches: 0 6 0.0 %

           Branch data     Line data    Source code
       1                 :            : /*-
       2                 :            :  * Copyright (c) 2012 Marin Atanasov Nikolov <dnaeon@gmail.com>
       3                 :            :  * Copyright (c) 2014 Matthew Seaman <matthew@FreeBSD.org>
       4                 :            :  * All rights reserved.
       5                 :            :  * 
       6                 :            :  * Redistribution and use in source and binary forms, with or without
       7                 :            :  * modification, are permitted provided that the following conditions
       8                 :            :  * are met:
       9                 :            :  * 1. Redistributions of source code must retain the above copyright
      10                 :            :  *    notice, this list of conditions and the following disclaimer
      11                 :            :  *    in this position and unchanged.
      12                 :            :  * 2. Redistributions in binary form must reproduce the above copyright
      13                 :            :  *    notice, this list of conditions and the following disclaimer in the
      14                 :            :  *    documentation and/or other materials provided with the distribution.
      15                 :            :  * 
      16                 :            :  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
      17                 :            :  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
      18                 :            :  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
      19                 :            :  * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
      20                 :            :  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
      21                 :            :  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
      22                 :            :  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
      23                 :            :  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
      24                 :            :  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
      25                 :            :  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
      26                 :            :  */
      27                 :            : 
      28                 :            : #include <getopt.h>
      29                 :            : #include <stdio.h>
      30                 :            : #include <stdbool.h>
      31                 :            : #include <unistd.h>
      32                 :            : 
      33                 :            : #include <pkg.h>
      34                 :            : 
      35                 :            : #include "pkgcli.h"
      36                 :            : 
      37                 :            : void
      38                 :          0 : usage_plugins(void)
      39                 :            : {
      40                 :          0 :         fprintf(stderr, "Usage: pkg plugins [-l] <plugin>\n\n");
      41                 :            :         //fprintf(stderr, "For more information see 'pkg help plugins'.\n");
      42                 :          0 : }
      43                 :            : 
      44                 :            : int
      45                 :          0 : exec_plugins(int argc, char **argv)
      46                 :            : {
      47                 :          0 :         struct pkg_plugin *p = NULL;
      48                 :            :         int ch;
      49                 :          0 :         bool __unused list_only = true;
      50                 :            : 
      51                 :          0 :         struct option longopts[] = {
      52                 :            :                 { "list-only",        no_argument,    NULL,   'l' },
      53                 :            :                 { NULL,         0,              NULL,   0   },
      54                 :            :         };
      55                 :            : 
      56         [ #  # ]:          0 :         while ((ch = getopt_long(argc, argv, "+l", longopts, NULL)) != -1) {
      57         [ #  # ]:          0 :                 switch (ch) {
      58                 :            :                 case 'l':
      59                 :          0 :                         list_only = true;
      60                 :          0 :                         break;
      61                 :            :                 default:
      62                 :          0 :                         usage_plugins();
      63                 :          0 :                         return (EXIT_FAILURE);
      64                 :            :                 }
      65                 :            :         }
      66                 :            : 
      67                 :            :         /**
      68                 :            :          * For now only display the available plugins
      69                 :            :          * @todo: implement enabling, disabling and configuring of plugins
      70                 :            :          */
      71                 :            : 
      72                 :          0 :         printf("%-10s %-45s %-10s\n", "NAME", "DESC", "VERSION");
      73         [ #  # ]:          0 :         while (pkg_plugins(&p) != EPKG_END)
      74                 :          0 :                 printf("%-10s %-45s %-10s\n",
      75                 :          0 :                        pkg_plugin_get(p, PKG_PLUGIN_NAME),
      76                 :          0 :                        pkg_plugin_get(p, PKG_PLUGIN_DESC),
      77                 :          0 :                        pkg_plugin_get(p, PKG_PLUGIN_VERSION));
      78                 :            : 
      79                 :          0 :         return (EXIT_SUCCESS);
      80                 :          0 : }

Generated by: LCOV version 1.15