# Path: ckanext/showcase/utils.py
# DATASET_TYPE_NAME = 'showcase'
# def check_edit_view_auth(id):
# def check_new_view_auth():
# def read_view(id):
# def manage_datasets_view(id):
# def migrate(allow_duplicates):
# def _get_related_dataset(related_id):
# def _find_duplicates(lst):
# def _gen_new_title(title, related_id):
# def _add_dataset_search(showcase_id, showcase_name):
#     def drill_down_url(alternative_url=None, **by):
#     def remove_field(key, value=None, replace=None):
#     def _sort_by(fields):
#     def pager_url(q=None, page=None):
# def _search_url(params, name):
# def _encode_params(params):
# def url_with_params(url, params):
# def delete_view(id):
# def dataset_showcase_list(id):
# def manage_showcase_admins():
# def remove_showcase_admin():
# def markdown_to_html():
# def upload():


from ckan.lib.cli import CkanCommand
from ckanext.showcase import utils
                               dest='allow_duplicates',
                               default=False,
                               help='''Use this option to allow
                            related items with duplicate titles to be migrated.
                            Duplicate showcases will be created as
                            'duplicate_<related-name>_<related-id>'.''',
                               action='store_true')

    def command(self):
        '''
        Parse command line arguments and call appropriate method.
        '''
        if not self.args or self.args[0] in ['--help', '-h', 'help']:
            print(self.__doc__)
            return

        cmd = self.args[0]
        self._load_config()

        if cmd == 'migrate':
            self.migrate()
        elif cmd == 'markdown-to-html':
            self.markdown_to_html()
        else:
            print('Command "{0}" not recognized'.format(cmd))

    def migrate(self):
        utils.migrate(self.options.allow_duplicates)

    def markdown_to_html(self):

# Path: ckanext/showcase/utils.py
# DATASET_TYPE_NAME = 'showcase'
# def check_edit_view_auth(id):
# def check_new_view_auth():
# def read_view(id):
# def manage_datasets_view(id):
# def migrate(allow_duplicates):
# def _get_related_dataset(related_id):
# def _find_duplicates(lst):
# def _gen_new_title(title, related_id):
# def _add_dataset_search(showcase_id, showcase_name):
#     def drill_down_url(alternative_url=None, **by):
#     def remove_field(key, value=None, replace=None):
#     def _sort_by(fields):
#     def pager_url(q=None, page=None):
# def _search_url(params, name):
# def _encode_params(params):
# def url_with_params(url, params):
# def delete_view(id):
# def dataset_showcase_list(id):
# def manage_showcase_admins():
# def remove_showcase_admin():
# def markdown_to_html():
# def upload():


# Path: ckanext/showcase/commands/paster.py
from ckan.lib.cli import CkanCommand
from ckanext.showcase import utils

                               dest='allow_duplicates',
                               default=False,
                               help='''Use this option to allow
                            related items with duplicate titles to be migrated.
                            Duplicate showcases will be created as
                            'duplicate_<related-name>_<related-id>'.''',
                               action='store_true')

    def command(self):
        '''
        Parse command line arguments and call appropriate method.
        '''
        if not self.args or self.args[0] in ['--help', '-h', 'help']:
            print(self.__doc__)
            return

        cmd = self.args[0]
        self._load_config()

        if cmd == 'migrate':
            self.migrate()
        elif cmd == 'markdown-to-html':
            self.markdown_to_html()
        else:
            print('Command "{0}" not recognized'.format(cmd))

    def migrate(self):
        utils.migrate(self.options.allow_duplicates)

    def markdown_to_html(self):

        utils.markdown_to_html()