Example #1
0
def minion_template(args):
    '''Create a Minion note from a specialized template.'''
    # Use the template specified on the command line
    params = get_params(args)
    templates = args['<template>']
    if len(templates) != 1:
        print 'Please specify exactly one template.'
    params['note_template'] = templates[0]
    brain.new_note_interactive(**params)
Example #2
0
def minion_template(args):
    '''Create a Minion note from a specialized template.'''
    # Use the template specified on the command line
    params = get_params(args)
    templates = args['<template>']
    if len(templates) != 1:
        print('Please specify exactly one template.')
    params['note_template'] = templates[0]
    brain.new_note_interactive(**params)
Example #3
0
    def test_template_duplicates(self):
        ''' Test that template does not recreate a file
        if a file with the same name alreadye exists. '''

        # Start clean
        TestFileStuff.clean_directory()

        # Create it elsewhere than the inbox.
        params = {
            'topic_fragments': ['testing', 'note', 'template'],
            'note_template': 'note',
            'notes_dir': TEST_DATA_NOT_INBOX,
            'quick': True
        }
        brain.new_note_interactive(**params)

        # Then create another copy, without specifying where.
        params = {
            'topic_fragments': ['testing', 'note', 'template'],
            'note_template': 'note',
            'quick': True
        }
        brain.new_note_interactive(**params)

        dir_contents = os.listdir(TEST_DATA_NOT_INBOX)
        # Inbox exists.
        self.assertEqual(len(dir_contents), 1, '1 in not_inbox')

        # See if we can find more than one.
        params = {
            'filter': ['testing', 'note', 'template'],
        }
        results = brain.find_files(**params)
        self.assertEqual(len(results), 1,
                         'note_template created ' + str(len(results)) +
                         ' files instead of exactly 1.')
Example #4
0
    def test_template_duplicates(self):
        ''' Test that template does not recreate a file
        if a file with the same name alreadye exists. '''

        # Start clean
        TestFileStuff.clean_directory()

        # Create it elsewhere than the inbox.
        params = {
            'topic_fragments': ['testing', 'note', 'template'],
            'note_template': 'note',
            'notes_dir': TEST_DATA_NOT_INBOX,
            'quick': True
        }
        brain.new_note_interactive(**params)

        # Then create another copy, without specifying where.
        params = {
            'topic_fragments': ['testing', 'note', 'template'],
            'note_template': 'note',
            'quick': True
        }
        brain.new_note_interactive(**params)

        dir_contents = os.listdir(TEST_DATA_NOT_INBOX)
        # Inbox exists.
        self.assertEqual(len(dir_contents), 1, '1 in not_inbox')

        # See if we can find more than one.
        params = {
            'filter': ['testing', 'note', 'template'],
        }
        results = brain.find_files(**params)
        self.assertEqual(
            len(results), 1, 'note_template created ' + str(len(results)) +
            ' files instead of exactly 1.')
Example #5
0
def minion_note(args):
    '''Create a Minion note.'''
    # It's the most common use, so use the default PARAMS exactly.
    params = get_params(args)
    brain.new_note_interactive(**params)
Example #6
0
def minion_here(args):
    '''Create a Minion note in the current working directory.'''
    params = get_params(args)
    # Use current directory
    params['notes_dir'] = os.curdir
    brain.new_note_interactive(**params)
Example #7
0
def minion_remind(args):
    '''Set a quick reminder.'''
    # Don't open it, just make it.
    params = get_params(args)
    params['quick'] = True
    brain.new_note_interactive(**params)
Example #8
0
def minion_note(args):
    '''Create a Minion note.'''
    # It's the most common use, so use the default PARAMS exactly.
    params = get_params(args)
    brain.new_note_interactive(**params)
Example #9
0
def minion_here(args):
    '''Create a Minion note in the current working directory.'''
    params = get_params(args)
    # Use current directory
    params['notes_dir'] = os.curdir
    brain.new_note_interactive(**params)
Example #10
0
def minion_remind(args):
    '''Set a quick reminder.'''
    # Don't open it, just make it.
    params = get_params(args)
    params['quick'] = True
    brain.new_note_interactive(**params)