1#!/usr/bin/env bash
2#
3# Copyright (c) 2019 Intel Corporation.
4#
5# SPDX-License-Identifier: Apache-2.0
6
7if [ -z "$1" ]; then
8    echo "Usage: $0 <doc build directory>"
9    echo
10    echo "The parameter needs to point to a directory where Zephyr html"
11    echo "documentation is generated."
12    echo "Typically this is $ZEPHYR_BASE/doc/_build"
13    echo
14    echo "This script will generate a list of networking related Kconfig options"
15    echo "that are missing from prj.conf file."
16    exit
17fi
18
19build_dir="$1"
20
21if [ ! -d $build_dir ]; then
22    echo "Directory $build_dir not found!"
23    exit
24fi
25
26kconfig_dir=$build_dir/rst/doc/reference/kconfig
27
28if [ ! -d $kconfig_dir ]; then
29    echo "Kconfig documentation not found at $kconfig_dir"
30    exit
31fi
32
33get_options()
34{
35    cd $kconfig_dir; ls CONFIG_DNS* CONFIG_NET* CONFIG_IEEE802154* | sed 's/\.rst//g'
36}
37
38get_options | while read opt
39do
40    grep -q $opt prj.conf > /dev/null 2>&1
41    if [ $? -ne 0 ]; then
42	echo "$opt"
43    fi
44done
45
46echo "Total number of options       : `get_options | wc -w`" > /dev/tty
47