code: def with_config(f):
      
      # keep it.
  
      @click.pass_context
      def new_func(ctx, *args, **kwargs):
          # Invoked with custom config:
          if 'config' in kwargs:
              return ctx.invoke(f, *args, **kwargs)
  
          if ctx.obj is None:
              ctx.obj = {}
  
          config = ctx.obj['config']
  
          project_enabled = not ctx.obj.get('no_project', False)
          project_config_path = get_project_config_path()
  
          if project_enabled and project_config_path:
              project_config = read_config(project_config_path)
              config['project'] = project_config
          result = ctx.invoke(f, config, *args, **kwargs)
          project_config = config.pop('project', None)
          if project_config:
              if not project_config_path:
                  raise RuntimeError('Invalid config update')
              write_config(project_config, path=project_config_path)
          write_config(config, path=ctx.obj['config_path'])
          if project_config is not None:
              config['project'] = project_config
          return result
  
      return update_wrapper(new_func, f)
docs: Add config to function.