Creates a new menu.

## OPTIONS

<menu-name>
: A descriptive name for the menu.

[--porcelain]
: Output just the new menu id.

## EXAMPLES

$ wp menu create "My Menu"
Success: Created menu 200.
498002
public function create( $args, $assoc_args ) {

		$menu_id = wp_create_nav_menu( $args[0] );

		if ( is_wp_error( $menu_id ) ) {

			WP_CLI::error( $menu_id->get_error_message() );

		} else {

			if ( Utils\get_flag_value( $assoc_args, 'porcelain' ) ) {
				WP_CLI::line( $menu_id );
			} else {
				WP_CLI::success( "Created menu {$menu_id}." );
			}
		}
	}
756080
private WMenu buildMenuBar(final WText selectedMenuText) {
		WMenu menu = new WMenu();

		// The Colours menu just shows simple text
		WSubMenu colourMenu = new WSubMenu("Colours");
		colourMenu.setMode(WSubMenu.MenuMode.LAZY);
		colourMenu.setAccessKey('C');
		addMenuItem(colourMenu, "Red", selectedMenuText);
		addMenuItem(colourMenu, "Green", selectedMenuText);
		addMenuItem(colourMenu, "Blue", selectedMenuText);
		colourMenu.addSeparator();
		colourMenu.add(new WMenuItem("Disable colour menu", new ToggleDisabledAction(colourMenu)));
		menu.add(colourMenu);

		// The Shapes menu shows grouping of items
		WSubMenu shapeMenu = new WSubMenu("Shapes");
		shapeMenu.setAccessKey('S');
		addMenuItem(shapeMenu, "Circle", selectedMenuText);

		WMenuItemGroup triangleGroup = new WMenuItemGroup("Triangles");
		shapeMenu.add(triangleGroup);
		shapeMenu.setMode(WSubMenu.MenuMode.DYNAMIC);
		addMenuItem(triangleGroup, "Equilateral", selectedMenuText);
		addMenuItem(triangleGroup, "Isosceles", selectedMenuText);
		addMenuItem(triangleGroup, "Scalene", selectedMenuText);
		addMenuItem(triangleGroup, "Right-angled", selectedMenuText);
		addMenuItem(triangleGroup, "Obtuse", selectedMenuText);

		WMenuItemGroup quadGroup = new WMenuItemGroup("Quadrilaterals");
		shapeMenu.add(quadGroup);
		addMenuItem(quadGroup, "Square", selectedMenuText);
		addMenuItem(quadGroup, "Rectangle", selectedMenuText);
		addMenuItem(quadGroup, "Rhombus", selectedMenuText);
		addMenuItem(quadGroup, "Trapezoid", selectedMenuText);
		addMenuItem(quadGroup, "Parallelogram", selectedMenuText);

		shapeMenu.addSeparator();
		shapeMenu.add(new WMenuItem("Disable shape menu", new ToggleDisabledAction(shapeMenu)));
		menu.add(shapeMenu);

		// The Image menu shows use of decorated labels and images
		WDecoratedLabel imageLabel = new WDecoratedLabel(new WImage("/image/wrench.png", "spanner"), new WText("Images"), null);
		WSubMenu imageMenu = new WSubMenu(imageLabel);
		imageMenu.add(createImageMenuItem("/image/flag.png", "Flag", "eg-menu-image-1",
				selectedMenuText));
		imageMenu.add(createImageMenuItem("/image/attachment.png", "Attachment", "eg-menu-image-2",
				selectedMenuText));
		imageMenu.add(createImageMenuItem("/image/settings.png", "Settings", "eg-menu-image-3",
				selectedMenuText));

		imageMenu.addSeparator();
		imageMenu.add(new WMenuItem("Disable image menu", new ToggleDisabledAction(imageMenu)));
		menu.add(imageMenu);

		WSubMenu sitesMenu = new WSubMenu("External apps");
		sitesMenu.add(new WMenuItem("External website", "http://www.example.com/"));
		WMenuItem google = new WMenuItem("Example (new window)", "http://www.example.com/");
		google.setTargetWindow("exampleWindow");
		sitesMenu.add(google);
		menu.add(sitesMenu);

		// Add an item to toggle the states of all the menus
		menu.add(new WMenuItem("Toggle top-level menus", new ToggleDisabledAction(colourMenu,
				shapeMenu, imageMenu,
				sitesMenu)));

		menu.add(new WMenuItem("Link", "http://www.example.com"));
		menu.add(new WMenuItem("No Action"));

		WMenuItem itemWithIcon = new WMenuItem("Help");
		itemWithIcon.setAction(new Action() {
			@Override
			public void execute(final ActionEvent event) {
				// do something
			}
		});
		itemWithIcon.setHtmlClass(HtmlClassProperties.ICON_HELP_BEFORE);
		menu.add(itemWithIcon);

		WMenuItem itemWithImage = new WMenuItem(new WDecoratedLabel(new WImage("/image/home.png", "home"), new WText("Home"), null));
		menu.add(itemWithImage);
		menu.add(new WMenuItem(new WDecoratedLabel(new WImage("/image/settings.png", "settings"), new WText("Settings Menu"), null)));
		itemWithImage = new WMenuItem(new WDecoratedLabel(new WImage("/image/flag.png", "flag")));
		itemWithImage.setAccessibleText("flag this view");
		menu.add(itemWithImage);
		return menu;
	}
832694
def _append(self, menu):
        ''''''
        from wx_loader import wx
        submenu = wx.Menu()
        for i in range(len(self.items)):
            submenu.AppendRadioItem(self.id()+i, self.items[i], self.description)
            if self.items[i] == self.initial:
                submenu.Check(self.id()+i, True)
        menu.AppendMenu(-1, self.name, submenu)
60946
def submenu key, label, &block
      item = CMenuItem.new(key, label)
      @options << item
      item.action = PromptMenu.new @caller, label, &block
    end
385575
function _createMenu () {
  // Set up the application menu1
  const template = [
    {
      label: 'File',
      submenu: [
        {
          label: 'New',
          submenu: [
            {
              label: 'Article',
              accelerator: 'CommandOrControl+N',
              click () {
                _openNew('article')
              }
            },
            {
              label: 'Figure Package',
              click () {
                _openNew('figure-package')
              }
            }
          ]
        },
        {
          label: 'Open',
          accelerator: 'CommandOrControl+O',
          click () {
            _promptOpen()
          }
        },
        {
          label: 'Save',
          accelerator: 'CommandOrControl+S',
          click () {
            _save()
          }
        },
        {
          label: 'Save As...',
          accelerator: 'CommandOrControl+Shift+S',
          click () {
            _saveAs()
          }
        }
      ]
    },
    {
      label: 'Edit',
      submenu: [
        { role: 'undo' },
        { role: 'redo' },
        { type: 'separator' },
        { role: 'cut' },
        { role: 'copy' },
        { role: 'paste' },
        { role: 'pasteandmatchstyle' },
        { role: 'delete' },
        { role: 'selectall' }
      ]
    },
    {
      label: 'View',
      submenu: [
        { role: 'toggledevtools' },
        { type: 'separator' },
        { role: 'resetzoom' },
        { role: 'zoomin' },
        { role: 'zoomout' },
        { type: 'separator' },
        { role: 'togglefullscreen' }
      ]
    },
    {
      role: 'window',
      submenu: [
        { role: 'minimize' },
        { role: 'close' }
      ]
    },
    {
      role: 'help',
      submenu: [
        {
          label: 'Learn More',
          click () {
            // TODO: why not use the globally required electron?
            shell.openExternal('http://substance.io/texture')
          }
        }
      ]
    }
  ]

  if (process.platform === 'darwin') {
    template.unshift({
      label: app.getName(),
      submenu: [
        { role: 'about' },
        { type: 'separator' },
        { role: 'services', submenu: [] },
        { type: 'separator' },
        { role: 'hide' },
        { role: 'hideothers' },
        { role: 'unhide' },
        { type: 'separator' },
        { role: 'quit' }
      ]
    })
  }

  const menu = Menu.buildFromTemplate(template)
  Menu.setApplicationMenu(menu)
}
1203011
public function newMenuItemAction(Menu $menu)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = new MenuItem();
        $entity->setMenu($menu);
        $form = $this->createMenuItemCreateForm($entity);

        return array(
            'entity' => $entity,
            'form' => $form->createView(),
        );
    }
470929
private MenuItem createNewMenuItem(int group, int id, int categoryOrder, int ordering,
                                       CharSequence title, int defaultShowAsAction) {
        return new MenuItem(group, id, categoryOrder, title);
    }
364432
public function add()
    {
        $this->loadModel('Menu.Menus');
        $menu = $this->Menus->newEntity();

        if ($this->request->data()) {
            $data = $this->request->data();
            $data['handler'] = 'Menu';
            $menu = $this->Menus->patchEntity($menu, $data, [
                'fieldList' => [
                    'title',
                    'handler',
                    'description',
                    'settings',
                ],
            ]);

            if ($this->Menus->save($menu, ['atomic' => true])) {
                $this->Flash->success(__d('menu', 'Menu has been created, now you can start adding links!'));
                $this->redirect(['plugin' => 'Menu', 'controller' => 'links', 'action' => 'add', $menu->id]);
            } else {
                $this->Flash->danger(__d('menu', 'Menu could not be created, please check your information'));
            }
        }

        $this->title(__d('menu', 'Create New Menu'));
        $this->set('menu', $menu);
        $this->Breadcrumb
            ->push('/admin/menu/manage')
            ->push(__d('menu', 'Creating new menu'), '#');
    }
969704
public function admin_menu(){
		$title = __('Google Analytics設定', 'gapiwp');
		$menu  = __('Analytics設定', 'gapiwp');
		add_options_page($title, $menu, 'manage_options', 'gapiwp-analytics', array($this, 'admin_render'));
	}
145633
function menu( items, nextStep ) {
    const rl = RL.createInterface( {
        input: process.stdin,
        output: process.stdout
    } );
    console.log();
    items.forEach( function ( item, idx ) {
        var out = idx < 10 ? ' ' : '';
        out += ( "" + ( 1 + idx ) + ") " ).yellow;
        out += item;
        console.log( out );
    } );
    console.log();
    rl.question( "Your choice: ", ( ans ) => {
        rl.close();
        var choice = parseInt( ans );
        if ( isNaN( ans ) || ans < 1 || ans > items.length ) {
            menu( items, nextStep );
        } else {
            console.log();
            nextStep( choice );
        }
    } );
}
299616
protected function createAdminMenu(): void
    {
        $menu = $this->menu();
        $events = $this->app->make('events');

        $handlers = [
            UserMenuHandler::class,
            ExtensionMenuHandler::class,
            SettingMenuHandler::class,
        ];

        $menu->add('home')
            ->title(\trans('orchestra/foundation::title.home'))
            ->link($this->handles('orchestra::/'))
            ->icon('home');

        foreach ($handlers as $handler) {
            $events->listen('orchestra.started: admin', $handler);
        }
    }
1260939
public function actionAdd ()
		{

			$menu = new Menu();
			$this->_tpl = '@menuViews/add';
			$this->setTitle(Yii::tr('Add menu item', [], 'menu'));
			$type = MenuType::findOne(Yii::$app->request->get('type'));
			if ($type == null)
				return;
			$root = null;
			$parentId = Yii::$app->request->get('parentID');
			if (!is_null($parentId))
			{
				$root = Menu::findOne([ 'id' => $parentId, 'typeID' => $type->id ]);
				$this->setTitle(Yii::tr('Add menu subitem to {title}', [ 'title' => $root->title ], 'menu'));
			}

			if (Yii::$app->request->isPost)
			{
				$post = Yii::$app->request->post('Menu');

				if (is_null($root))
				{
					$root = Menu::findOne([ 'title' => $type->guid . '_ROOT', 'typeID' => $type->id ]);
					if ($root == null)
					{
						$root = new Menu([ 'title' => $type->guid . '_ROOT', 'typeID' => $type->id ]);
						$root->makeRoot();
					}
				}

				$menu->setAttributes([
					'title'  => $post[ 'title' ],
					'url'    => $post[ 'url' ],
					'path'   => $post[ 'path' ],
					'typeID' => $type->id
				]);

				$menu->appendTo($root);
				Yii::$app->notification->messageToSession(Yii::tr('Menu item was saved.', [], 'menu'));
				$this->redirect(Url::toRoute([ '/menu/index', 'type' => $type->id ]));
			}
			$this->data('model', $menu);
		}
938251
@Override
    public MenuState<String> newMenuState(String value, boolean changed, boolean active) {
        return new StringMenuState(changed, active, value);
    }
245598
protected function createMenuFile()
    {
        $file = $this->directory.'/menu.php';

        $contents = $this->getStub('menu');
        $this->laravel['files']->put($file, $contents);
        $this->line('<info>Menu file was created:</info> '.str_replace(base_path(), '', $file));
    }
87516
def add_view_menu(self, name):
        
        view_menu = self.find_view_menu(name)
        if view_menu is None:
            try:
                view_menu = self.viewmenu_model(name=name)
                view_menu.save()
                return view_menu
            except Exception as e:
                log.error(c.LOGMSG_ERR_SEC_ADD_VIEWMENU.format(str(e)))
        return view_menu
126379
def make_menu(self):
        """"""

        menu = wx.Menu()
        item = menu.Append(-1, "Recent Searches")
        item.Enable(False)

        for __id, txt in enumerate(self.search_history):
            menu.Append(__id, txt)
        return menu
1310405
protected function createAdminMenu()
    {

        $config = config('menu');
        $events = $this->app->make('events');
        foreach ($config as $event => $ordered) {
            foreach ($ordered as $name => $value) {
                if (is_numeric($name)) {
                    $events->listen($event, $value);
                } else {
                    $events->listen($event, $name, $value);
                }
            }
        }
    }