本文整理匯總了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}`);
});
示例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!');
});
示例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');
});
示例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);
}
}
示例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);
}
}
示例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;
}
}
示例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));