当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript terminal.logLine函数代码示例

本文整理汇总了TypeScript中@es-git/terminal.logLine函数的典型用法代码示例。如果您正苦于以下问题:TypeScript logLine函数的具体用法?TypeScript logLine怎么用?TypeScript logLine使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了logLine函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: Date

  formElm.addEventListener('submit', async e => {
    e.preventDefault();

    const text = contentElm.value;
    if(!text){
      terminal.logLine('Content needed');
      return;
    }

    const newCommit : Folder = {
      folders: originalCommit.folders,
      files: {
        ...originalCommit.files,
        'readme.md': {
          text
        }
      }
    }

    const author : Person = {
      name: nameElm.value,
      email: emailElm.value,
      date: new Date()
    };

    const hash = await repo.commit('refs/heads/master', newCommit, messageElm.value, author);

    terminal.logLine(`Commited, new hash ${hash}`);

  });
开发者ID:strangesast,项目名称:es-git,代码行数:30,代码来源:push.ts

示例2: mix

formElm.addEventListener('submit', async e => {
  e.preventDefault();

  const url = inputElm.value;
  const match = url && /^\https:\/\/(.*)$/.exec(url);
  if(!match){
    outputElm.innerText = 'not a valid url';
    return;
  }

  const Repo = mix(MemoryRepo)
  .with(object)
  .with(walkers)
  .with(fetchMixin, fetch);
  const terminal = new Terminal(m => outputElm.innerText = m);

  terminal.logLine('Creating local repo');

  const repo = new Repo();
  terminal.logLine(`Fetching from ${url}.git`);
  const result = await repo.fetch(`/proxy/${match[1]}.git`, 'refs/heads/*:refs/heads/*', {
    progress: message => terminal.log(message)
  })

  for(const ref of result){
    terminal.logLine(`* ${ref.name} -> ${ref.hash}`);
  }

  terminal.logLine('');
  terminal.logLine('Done!');
});
开发者ID:strangesast,项目名称:es-git,代码行数:31,代码来源:fetch.ts

示例3:

  pushElm.addEventListener('click', async e => {
    e.preventDefault();

    terminal.logLine('Starting push');
    await repo.push(`/proxy/${url}.git`, 'refs/heads/master', user, { progress: message => terminal.log(message) })

    terminal.logLine('Push completed');
  });
开发者ID:strangesast,项目名称:es-git,代码行数:8,代码来源:push.ts

示例4: push

function* push(user : OauthData, components : string[]){
  var terminal = new Terminal();
  try{
    yield put(gitProgressStatus('busy'));
    yield put(gitProgressMessage(terminal.logLine(`Pushing...`)));
    yield put(showPopup('GitProgress'));
    yield* withProgress(terminal, emit => storage.push(user, components, emit));
    yield put(gitProgressStatus('success'));
    yield put(hidePopup());
  }catch(e){
    terminal.logLine();
    yield put(gitProgressStatus('failure'));
    yield put(gitProgressMessage(terminal.log(e.message)));
    console.error(e);
  }
}
开发者ID:mariusGundersen,项目名称:Ekkiog,代码行数:16,代码来源:saga.ts

示例5: fetch

function* fetch(){
  var terminal = new Terminal();
  try{
    yield put(gitProgressStatus('busy'));
    yield put(gitProgressMessage(terminal.logLine(`Fetching...`)));
    yield put(showPopup('GitProgress'));
    yield* withProgress(terminal, emit => storage.fetch(emit));
    yield put(gitProgressStatus('success'));
    yield put(hidePopup());
  }catch(e){
    terminal.logLine();
    yield put(gitProgressStatus('failure'));
    yield put(gitProgressMessage(terminal.log(e.message)));
    console.error(e);
  }
}
开发者ID:mariusGundersen,项目名称:Ekkiog,代码行数:16,代码来源:saga.ts

示例6: pull

function* pull(repo : string, name : string, hash? : string){
  var terminal = new Terminal();
  try{
    yield put(gitProgressStatus('busy'));
    yield put(gitProgressMessage(terminal.logLine(`Loading ${name}\nfrom ${repo}`)));
    yield put(showPopup('GitProgress'));
    yield* fetchWithProgress(repo, name, hash, terminal);
    yield put(gitProgressStatus('success'));
    yield put(hidePopup());
    return yield storage.load(repo, name, hash);
  }catch(e){
    terminal.logLine();
    yield put(gitProgressStatus('failure'));
    yield put(gitProgressMessage(terminal.log(e.message)));
    throw e;
  }
}
开发者ID:mariusGundersen,项目名称:Ekkiog,代码行数:17,代码来源:loadForest.ts

示例7: function

(async function(){

  const url = 'github.com/es-git/test-push';
  const user = {
    username: '...',
    password: '...'
  };
  const contentElm = document.querySelector<HTMLInputElement>('#content') as HTMLInputElement;
  const messageElm = document.querySelector<HTMLInputElement>('#message') as HTMLInputElement;
  const nameElm = document.querySelector<HTMLInputElement>('#name') as HTMLInputElement;
  const emailElm = document.querySelector<HTMLInputElement>('#email') as HTMLInputElement;
  const outputElm = document.querySelector<HTMLPreElement>('pre') as HTMLPreElement;
  const formElm = document.querySelector<HTMLFormElement>('form') as HTMLFormElement;
  const pushElm = document.querySelector<HTMLButtonElement>('#push') as HTMLButtonElement;

  const Repo = mix(MemoryRepo)
  .with(object)
  .with(walkers)
  .with(checkout)
  .with(commit)
  .with(fetchMixin, fetch)
  .with(pushMixin, fetch)
  const terminal = new Terminal(m => outputElm.innerText = m);

  terminal.logLine('Creating local repo');

  const repo = new Repo();
  terminal.logLine(`Fetching from ${url}.git`);
  const result = await repo.fetch(`/proxy/${url}.git`, 'refs/heads/master:refs/heads/master', {
    progress: message => terminal.log(message)
  })

  for(const ref of result){
    terminal.logLine(`* ${ref.name} -> ${ref.hash}`);
  }

  terminal.logLine('');
  terminal.logLine('Done!');

  const originalCommit = await repo.checkout('refs/heads/master');
  contentElm.value = originalCommit.files['readme.md'].text;

  formElm.addEventListener('submit', async e => {
    e.preventDefault();

    const text = contentElm.value;
    if(!text){
      terminal.logLine('Content needed');
      return;
    }

    const newCommit : Folder = {
      folders: originalCommit.folders,
      files: {
        ...originalCommit.files,
        'readme.md': {
          text
        }
      }
    }

    const author : Person = {
      name: nameElm.value,
      email: emailElm.value,
      date: new Date()
    };

    const hash = await repo.commit('refs/heads/master', newCommit, messageElm.value, author);

    terminal.logLine(`Commited, new hash ${hash}`);

  });

  pushElm.addEventListener('click', async e => {
    e.preventDefault();

    terminal.logLine('Starting push');
    await repo.push(`/proxy/${url}.git`, 'refs/heads/master', user, { progress: message => terminal.log(message) })

    terminal.logLine('Push completed');
  });

})().then(_ => console.log('success!'), e => console.error(e));
开发者ID:strangesast,项目名称:es-git,代码行数:83,代码来源:push.ts


注:本文中的@es-git/terminal.logLine函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。