# Path: awsshell/utils.py
# def build_config_file_path(file_name):
#     return os.path.join(os.path.expanduser('~'), '.aws', 'shell', file_name)


import os
import shutil
from configobj import ConfigObj
from awsshell.utils import build_config_file_path
#     http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.




class Config(object):
    """Reads and writes the config template and user config file."""

    def load(self, config_template, config_file=None):
        """Read the config file if it exists, else read the default config.

        Creates the user config file if it doesn't exist using the template.

        :type config_template: str
        :param config_template: The config template file name.

        :type config_file: str
        :param config_file: (Optional) The config file name.
            If None, the config_file name will be set to the config_template.

        :rtype: :class:`configobj.ConfigObj`
        :return: The config information for reading and writing.
        """
        if config_file is None:
            config_file = config_template

# Path: awsshell/utils.py
# def build_config_file_path(file_name):
#     return os.path.join(os.path.expanduser('~'), '.aws', 'shell', file_name)


# Path: awsshell/config.py
import os
import shutil
from configobj import ConfigObj
from awsshell.utils import build_config_file_path

#     http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.




class Config(object):
    """Reads and writes the config template and user config file."""

    def load(self, config_template, config_file=None):
        """Read the config file if it exists, else read the default config.

        Creates the user config file if it doesn't exist using the template.

        :type config_template: str
        :param config_template: The config template file name.

        :type config_file: str
        :param config_file: (Optional) The config file name.
            If None, the config_file name will be set to the config_template.

        :rtype: :class:`configobj.ConfigObj`
        :return: The config information for reading and writing.
        """
        if config_file is None:
            config_file = config_template

        config_path = build_config_file_path(config_file)